From 53b8bf53ec1d6b8d825ffe05a1131fd7b36fccf0 Mon Sep 17 00:00:00 2001 From: mortezaei Date: Fri, 15 May 2026 20:43:02 +0330 Subject: [PATCH] fix: streamline login response handling and improve token availability warning --- src/lib/auth-bridge.ts | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/lib/auth-bridge.ts b/src/lib/auth-bridge.ts index a315b11..07958a2 100644 --- a/src/lib/auth-bridge.ts +++ b/src/lib/auth-bridge.ts @@ -95,24 +95,18 @@ class AuthBridge { private handleLoginResponse(success: boolean) { if (success) { + this.loginRequested = false; + if (this.syncFromStorage()) { - this.loginRequested = false; this.markReady(this.token); return; } - window.setTimeout(() => { - if (this.syncFromStorage()) { - this.loginRequested = false; - this.markReady(this.token); - return; - } - - console.warn("⚠️ Flutter login response arrived before token"); - this.loginRequested = false; - this.resolvePending(null); - this.markReady(null); - }, 50); + console.warn( + "⚠️ Flutter login succeeded, but token is not available yet. Set cookie before emitting success.", + ); + this.resolvePending(null); + this.markReady(null); return; }