From 9a3b123e654d8217db288adea8f64d84ab4daec0 Mon Sep 17 00:00:00 2001 From: "dong.huo" Date: Sat, 26 Nov 2022 19:29:52 +0800 Subject: [PATCH] getToken is unnecessary --- middleware.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/middleware.ts b/middleware.ts index 9f05fd1..b8c2617 100644 --- a/middleware.ts +++ b/middleware.ts @@ -1,10 +1,9 @@ -import { getToken } from "next-auth/jwt" import { withAuth } from "next-auth/middleware" import { NextResponse } from "next/server" export default withAuth( async function middleware(req) { - const token = await getToken({ req }) + const { token } = req.nextauth const isAuth = !!token const isAuthPage = req.nextUrl.pathname.startsWith("/login") ||