Fix: Cookies

This commit is contained in:
2024-11-26 01:06:46 +08:00
parent ac5b8a8c4b
commit 038c40a6fb
29 changed files with 341 additions and 172 deletions

View File

@@ -1,21 +0,0 @@
import _ from "lodash";
import { NextRequest, NextResponse } from "next/server";
// This function can be marked `async` if using `await` inside
export function middleware(request: NextRequest) {
let cookies = request.cookies.get("mySession");
console.log(cookies);
if (
!cookies ||
!cookies?.value ||
_.isEmpty(cookies?.value) ||
_.isUndefined(cookies?.value)
) {
return NextResponse.redirect(new URL("/dev/auth/login", request.url));
}
}
export const config = {
matcher: ["/((?!_next|static|favicon.ico|manifest).*)"],
};