mirror of
https://github.com/xtr-dev/rondevu-demo.git
synced 2025-12-13 03:53:22 +00:00
fix: Create Rondevu instance in handleClaimUsername for new users
The previous change broke the claim flow for new users because handleClaimUsername expected rondevu to exist, but we stopped creating it during initialization for new users. Now handleClaimUsername creates the Rondevu instance itself.
This commit is contained in:
@@ -328,18 +328,19 @@ export default function App() {
|
||||
|
||||
// Claim username
|
||||
const handleClaimUsername = async () => {
|
||||
if (!rondevu || !usernameInput) return;
|
||||
if (!usernameInput) return;
|
||||
|
||||
try {
|
||||
const keypair = rondevu.getKeypair();
|
||||
// Create new Rondevu instance (will generate keypair if needed)
|
||||
const newService = new Rondevu({
|
||||
apiUrl: API_URL,
|
||||
username: usernameInput,
|
||||
keypair,
|
||||
keypair: rondevu?.getKeypair(), // Use existing keypair if available, otherwise will generate new one
|
||||
});
|
||||
await newService.initialize();
|
||||
await newService.claimUsername();
|
||||
|
||||
const keypair = newService.getKeypair();
|
||||
setRondevu(newService);
|
||||
setMyUsername(usernameInput);
|
||||
localStorage.setItem('rondevu-username', usernameInput);
|
||||
|
||||
Reference in New Issue
Block a user