Files
site/apps/web/src/modules/auth/store/authSessionHint.ts
T
vlad 86cc3fa541 Update admin theme/layout and refresh README details.
Align the project baseline with the latest admin interface styling and layout structure while documenting setup and usage updates in README.
2026-07-14 17:12:28 +03:00

25 lines
743 B
TypeScript

const AUTH_HINT_KEY = "compton-auth-hint";
const PROTECTED_PATH_PREFIXES = ["/admin", "/profile"] as const;
export function markAuthSessionHint(): void {
sessionStorage.setItem(AUTH_HINT_KEY, "1");
}
export function clearAuthSessionHint(): void {
sessionStorage.removeItem(AUTH_HINT_KEY);
}
export function hasAuthSessionHint(): boolean {
return sessionStorage.getItem(AUTH_HINT_KEY) === "1";
}
export function isProtectedAppPath(pathname: string): boolean {
return PROTECTED_PATH_PREFIXES.some(
(prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`)
);
}
export function shouldAttemptAuthRefresh(pathname = window.location.pathname): boolean {
return hasAuthSessionHint() || isProtectedAppPath(pathname);
}