Files
webdev-pipeline/lib/route-guards.ts

15 lines
353 B
TypeScript

export function isDashboardPath(pathname: string) {
return pathname.startsWith("/dashboard");
}
export function shouldRedirectDashboardRequest(
pathname: string,
hasSession: boolean,
) {
return isDashboardPath(pathname) && !hasSession;
}
export function getDashboardRedirectPath(hasSession: boolean) {
return hasSession ? null : "/login";
}