Client portal: profile, activity pages + middleware fix

This commit is contained in:
JCBSComputer
2026-07-01 11:25:08 +02:00
parent 5d971dc749
commit 6016ab2855
23 changed files with 1789 additions and 2 deletions
+4 -1
View File
@@ -3,6 +3,8 @@ import type { NextRequest } from "next/server"
const publicRoutes = [
"/login",
"/client-portal/login",
"/client-portal/api",
"/api/auth/login",
"/api/auth/logout",
"/_next/static",
@@ -29,7 +31,8 @@ export async function middleware(request: NextRequest) {
if (pathname.startsWith("/api/")) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
}
const loginUrl = new URL("/login", request.url)
const loginPath = pathname.startsWith("/client-portal") ? "/client-portal/login" : "/login"
const loginUrl = new URL(loginPath, request.url)
loginUrl.searchParams.set("redirect", pathname)
return NextResponse.redirect(loginUrl)
}