21 lines
551 B
TypeScript
21 lines
551 B
TypeScript
export function getAuthLoginRedirectUrl(): string {
|
|
return (
|
|
process.env.NEXT_PUBLIC_AUTH_LOGIN_REDIRECT_URL ||
|
|
process.env.NEXT_PUBLIC_CM_LOGIN_PAGE_URL ||
|
|
"/auth/login"
|
|
);
|
|
}
|
|
|
|
export function isAtLoginRedirectUrl(loginRedirectUrl: string): boolean {
|
|
if (typeof window === "undefined") return false;
|
|
try {
|
|
const target = new URL(loginRedirectUrl, window.location.href);
|
|
return (
|
|
target.origin === window.location.origin &&
|
|
target.pathname === window.location.pathname
|
|
);
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|