fix: remove middleware redirect, let login page handle auth check

This commit is contained in:
2026-06-28 22:46:57 -05:00
parent f99da73118
commit 7f81833936
2 changed files with 30 additions and 15 deletions
+3 -14
View File
@@ -1,21 +1,10 @@
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
// Simple middleware for Next.js Edge Runtime
// This is a basic implementation that doesn't verify tokens
// In a production environment, you would want to verify the token
// Middleware runs on edge runtime - we can't verify JWT here easily
// Let the pages handle auth checks via /api/auth/me
export function middleware(request: NextRequest) {
const { pathname } = request.nextUrl;
const token = request.cookies.get('session')?.value;
// Protect admin routes - let page handle auth UI
// No redirect here; the admin page shows login prompt if not authenticated
// If logged in and trying to access login, redirect to admin
if (pathname === '/login' && token) {
return NextResponse.redirect(new URL('/admin', request.url));
}
// No redirects - login and admin pages handle their own auth UI
return NextResponse.next();
}