feat(auth): add frontend login and route protection

This commit is contained in:
DS | Schubert 2026-07-02 17:00:50 +02:00
parent 6f7cae9e24
commit 4bc8b20a21
5 changed files with 116 additions and 19 deletions

View file

@ -0,0 +1,18 @@
import { NextRequest, NextResponse } from "next/server";
export function middleware(request: NextRequest) {
const token = request.cookies.get("access_token");
if (!token) {
return NextResponse.redirect(new URL("/login", request.url));
}
return NextResponse.next();
}
export const config = {
matcher: [
"/dashboard/:path*",
"/users/:path*",
],
};