refac
This commit is contained in:
1 parent
609cc6ad9b
commit
29782aba01
1 file changed
+8
-5
@@ -843,8 +843,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
isAuthRedirectInProgress = true;
|
isAuthRedirectInProgress = true;
|
||||||
|
if (tokenTimer) {
|
||||||
|
clearInterval(tokenTimer);
|
||||||
|
tokenTimer = null;
|
||||||
|
}
|
||||||
user.set(null);
|
user.set(null);
|
||||||
localStorage.removeItem('token');
|
localStorage.removeItem('token');
|
||||||
|
userSignOut().catch((error) => {
|
||||||
|
console.error('Error signing out expired session:', error);
|
||||||
|
});
|
||||||
toast.error($i18n.t('Session expired. Please sign in again.'));
|
toast.error($i18n.t('Session expired. Please sign in again.'));
|
||||||
|
|
||||||
const currentPath = `${window.location.pathname}${window.location.search}`;
|
const currentPath = `${window.location.pathname}${window.location.search}`;
|
||||||
@@ -876,11 +883,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (now >= exp - TOKEN_EXPIRY_BUFFER) {
|
if (now >= exp - TOKEN_EXPIRY_BUFFER) {
|
||||||
const res = await userSignOut();
|
redirectToAuthAfterUnauthorized();
|
||||||
user.set(null);
|
|
||||||
localStorage.removeItem('token');
|
|
||||||
|
|
||||||
location.href = res?.redirect_url ?? '/auth';
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user