fixed middleware and barnavigation
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import type { NextRequest } from "next/server";
|
||||
|
||||
export function middleware(request: NextRequest) {
|
||||
const token = request.cookies.get("token")?.value;
|
||||
|
||||
if (!token) {
|
||||
console.log("No hay token, redirigiendo a la página de inicio de sesión");
|
||||
return NextResponse.redirect(new URL("/", request.url));
|
||||
}
|
||||
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/AgregarEquipo", "/Escaner"],
|
||||
};
|
||||
//IO
|
||||
Reference in New Issue
Block a user