Browse Source

fix: streamline login response handling and improve token availability warning

master
mortezaei 2 months ago
parent
commit
53b8bf53ec
  1. 20
      src/lib/auth-bridge.ts

20
src/lib/auth-bridge.ts

@ -95,24 +95,18 @@ class AuthBridge {
private handleLoginResponse(success: boolean) { private handleLoginResponse(success: boolean) {
if (success) { if (success) {
this.loginRequested = false;
if (this.syncFromStorage()) { if (this.syncFromStorage()) {
this.loginRequested = false;
this.markReady(this.token); this.markReady(this.token);
return; 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; return;
} }

Loading…
Cancel
Save