fix: exempt /api/admin/login from admin session check in middleware

The login API was blocked by the admin session middleware, preventing
the creation of the session cookie. Now the API endpoint is exempted
alongside the login page.
This commit is contained in:
dimitar 2026-07-29 19:46:08 +02:00
parent 09acf20b9b
commit 117f9fadfc

View File

@ -31,7 +31,7 @@ function getSubdomain(req: NextRequest): string | null {
export default clerkMiddleware(async (auth, req: NextRequest) => {
if (isAdminRoute(req.nextUrl.pathname)) {
if (req.nextUrl.pathname === "/admin/login") {
if (req.nextUrl.pathname === "/admin/login" || req.nextUrl.pathname === "/api/admin/login") {
return NextResponse.next();
}