Add Better Auth admin authentication
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
import type { MockSession } from "@/lib/mock-auth";
|
||||
|
||||
export function getDashboardRedirectPath(session: MockSession | null) {
|
||||
return session ? null : "/";
|
||||
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";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user