feat: complete MVP foundation auth and dashboard
This commit is contained in:
21
proxy.ts
Normal file
21
proxy.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { NextResponse, type NextRequest } from "next/server";
|
||||
|
||||
import { MOCK_SESSION_COOKIE_NAME } from "@/lib/mock-auth";
|
||||
import { shouldRedirectDashboardRequest } from "@/lib/proxy-auth";
|
||||
|
||||
export function proxy(request: NextRequest) {
|
||||
if (
|
||||
shouldRedirectDashboardRequest(
|
||||
request.nextUrl.pathname,
|
||||
request.cookies.get(MOCK_SESSION_COOKIE_NAME)?.value,
|
||||
)
|
||||
) {
|
||||
return NextResponse.redirect(new URL("/", request.url));
|
||||
}
|
||||
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: "/dashboard/:path*",
|
||||
};
|
||||
Reference in New Issue
Block a user