hotfix: Implement client-side dashboard redirect with loading spinner, improve authentication error handling by clearing user state on 401, and extend SSO redirect loop protection.

This commit is contained in:
ValdiANS
2025-12-10 16:23:51 +07:00
parent 757e0435ac
commit aed58ef10c
3 changed files with 20 additions and 7 deletions
+2 -2
View File
@@ -10,9 +10,9 @@ export const redirectToSSO = () => {
const lastRedirect = sessionStorage.getItem('auth_redirect_timestamp');
const now = Date.now();
// Loop protection: allow redirect only if last one was > 2 seconds ago
// Loop protection: allow redirect only if last one was > 5 seconds ago
// or if no redirect has happened yet.
if (!lastRedirect || now - parseInt(lastRedirect, 10) > 2000) {
if (!lastRedirect || now - parseInt(lastRedirect, 10) > 5000) {
sessionStorage.setItem('auth_redirect_timestamp', now.toString());
// const ssoLoginUrl = `${process.env.NEXT_PUBLIC_SSO_LOGIN_URL as string}?redirect_url=${window.location.href}`;