feat: ajout structure projet + config Node 20
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { auth } from "@/lib/auth";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export default auth((req) => {
|
||||
const isLoggedIn = !!req.auth;
|
||||
const isOnDashboard = req.nextUrl.pathname.startsWith("/dashboard");
|
||||
|
||||
if (isOnDashboard && !isLoggedIn) {
|
||||
return NextResponse.redirect(new URL("/login", req.url));
|
||||
}
|
||||
|
||||
return NextResponse.next();
|
||||
});
|
||||
|
||||
export const config = {
|
||||
matcher: ["/dashboard/:path*"],
|
||||
};
|
||||
Reference in New Issue
Block a user