mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-07-14 18:15:56 -04:00
Redirect authenticated users from landing page to dashboard
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,14 @@ import { type NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export function proxy(request: NextRequest) {
|
||||
const sessionCookie = getSessionCookie(request);
|
||||
const { pathname } = request.nextUrl;
|
||||
|
||||
if (pathname === "/") {
|
||||
if (sessionCookie) {
|
||||
return NextResponse.redirect(new URL("/dashboard", request.url));
|
||||
}
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
if (!sessionCookie) {
|
||||
return NextResponse.redirect(new URL("/login", request.url));
|
||||
@@ -12,5 +20,12 @@ export function proxy(request: NextRequest) {
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/dashboard", "/explore", "/settings", "/setup", "/titles/:path*"],
|
||||
matcher: [
|
||||
"/",
|
||||
"/dashboard",
|
||||
"/explore",
|
||||
"/settings",
|
||||
"/setup",
|
||||
"/titles/:path*",
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user