Fix crypto and message duplication

This commit is contained in:
2025-08-30 12:14:36 +03:00
Unverified
parent ebd075136b
commit bd52b3c05a
4 changed files with 55 additions and 29 deletions
+6 -3
View File
@@ -55,13 +55,16 @@ export default function LoginScreen() {
if (response.ok) {
const data: LoginResponse = await response.json();
// Store the JWT token
setUser(data.token, data.user)
// Store the JWT token first
setUser(data.token, data.user);
// Setup keys with the token we just received
try {
await ensureKeysOnLogin(password);
await ensureKeysOnLogin(password, data.token);
} catch (e) {
console.error("Key setup failed:", e);
}
setCurrentPage("chat");
// initializeProfile(); // Initialize profile after login
} else {