From 93b1fec3641fe809629f3773d12cd5629dd6f2af Mon Sep 17 00:00:00 2001 From: Maximilian Liebmann Date: Sat, 19 Apr 2025 20:51:08 +0200 Subject: [PATCH] feat: added default route to /login --- src/app/api/auth/[...nextauth]/route.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/api/auth/[...nextauth]/route.ts b/src/app/api/auth/[...nextauth]/route.ts index c95521a..cb15ae3 100644 --- a/src/app/api/auth/[...nextauth]/route.ts +++ b/src/app/api/auth/[...nextauth]/route.ts @@ -1,2 +1,10 @@ -import { handlers } from '@/auth'; // Referring to the auth.ts we just created +import { handlers } from '@/auth'; +import { NextRequest, NextResponse } from 'next/server'; + export const { GET, POST } = handlers; + +export async function middleware(request: NextRequest) { + if (request.nextUrl.pathname === '/') { + return NextResponse.redirect(new URL('/login', request.url)); + } +}