mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 01:35:39 -04:00
Rename middleware.ts to proxy.ts and export as proxy function
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { getSessionCookie } from "better-auth/cookies";
|
||||
import { type NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export function proxy(request: NextRequest) {
|
||||
const sessionCookie = getSessionCookie(request);
|
||||
|
||||
if (!sessionCookie) {
|
||||
return NextResponse.redirect(new URL("/login", request.url));
|
||||
}
|
||||
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/dashboard", "/explore", "/settings", "/setup", "/titles/:path*"],
|
||||
};
|
||||
Reference in New Issue
Block a user