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:
2025-12-12 12:05:45 +01:00
parent 830f411291
commit 5789fc636b

View File

@@ -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);