refactor: standardize theme colors, update UI components, and refine auth redirection logic

This commit is contained in:
Firman Ramdhani
2026-07-31 11:49:09 +07:00
parent f91bbefddc
commit 2c8c9d22b4
10 changed files with 95 additions and 70 deletions
+14 -8
View File
@@ -25,15 +25,21 @@ export async function terminateAuthSession(options: TerminateOptions = {}) {
*/
let loginUrl = '/auth/login';
if (preserveRedirect) {
const currentPath = window.location.pathname + window.location.search;
loginUrl += `?redirect=${encodeURIComponent(currentPath)}`;
}
// Check if the current page is NOT the login page
const isNotLoginPage = !window.location.pathname.includes('/auth/login');
/**
* Redirect without saving history to prevent infinite back-loops
*/
window.location.replace(loginUrl);
if (isNotLoginPage) {
// Set redirect parameters only if requested AND the user is not currently on the login page
if (preserveRedirect) {
const currentPath = window.location.pathname + window.location.search;
loginUrl += `?redirect=${encodeURIComponent(currentPath)}`;
}
/**
* Redirect without saving history to prevent infinite back-loops
*/
window.location.replace(loginUrl);
}
}
export async function initiateAuthSession(respLogin: any) {