refactor: standardize theme colors, update UI components, and refine auth redirection logic
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user