fix and update

This commit is contained in:
lendry
2026-07-01 23:27:48 +03:00
parent 2b88e028c6
commit bcdfbc3861
36 changed files with 1504 additions and 320 deletions

View File

@@ -456,6 +456,23 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
void refreshProfile();
}, [refreshProfile]);
React.useEffect(() => {
if (!isSessionReady || isPinLocked) return;
if (pathname.startsWith('/auth/')) return;
const accessToken = token ?? window.localStorage.getItem(AUTH_TOKEN_KEY);
if (!accessToken) return;
void fetchAuthSession(accessToken)
.then((session) => {
applySessionState(session, { setUser, setToken, activatePinLock, clearPinLock });
})
.catch((error) => {
if (isPinRequiredError(error)) {
activatePinLock(error.sessionId ?? window.localStorage.getItem(AUTH_SESSION_KEY) ?? '');
}
});
}, [activatePinLock, clearPinLock, isPinLocked, isSessionReady, pathname, token]);
React.useEffect(() => {
function handleVisibilityChange() {
if (document.visibilityState !== 'visible') return;