fix and update
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
AUTH_USER_CACHE_KEY,
|
||||
AuthSessionResponse,
|
||||
AuthTokens,
|
||||
ensureApiGatewayReady,
|
||||
fetchAuthSession,
|
||||
getDeviceFingerprint,
|
||||
IdentifyResponse,
|
||||
@@ -159,10 +160,10 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
cacheUserProfile(auth.user);
|
||||
setHasStoredSession(true);
|
||||
clearPinLock();
|
||||
setIsLoading(true);
|
||||
void ensureApiGatewayReady().finally(() => setIsLoading(false));
|
||||
if (auth.pinVerified !== false) {
|
||||
window.setTimeout(() => {
|
||||
void syncFedcmSession(auth.accessToken);
|
||||
}, 300);
|
||||
void syncFedcmSession(auth.accessToken);
|
||||
}
|
||||
},
|
||||
[clearPinLock]
|
||||
@@ -255,6 +256,16 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
if (message) showToast(message);
|
||||
logout();
|
||||
} finally {
|
||||
const hasSession = Boolean(
|
||||
window.localStorage.getItem(AUTH_TOKEN_KEY) || window.localStorage.getItem(AUTH_REFRESH_KEY)
|
||||
);
|
||||
if (hasSession) {
|
||||
try {
|
||||
await ensureApiGatewayReady();
|
||||
} catch {
|
||||
// Продолжаем даже если gateway не ответил в срок прогрева.
|
||||
}
|
||||
}
|
||||
setIsLoading(false);
|
||||
refreshInFlightRef.current = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user