Redirect authenticated users from landing page to dashboard

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 13:00:06 -05:00
co-authored by Claude Opus 4.6
parent 1a5a1e631c
commit 64351cb896
+16 -1
View File
@@ -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*",
],
};