getToken is unnecessary

This commit is contained in:
dong.huo 2022-11-26 19:29:52 +08:00
parent c746a6a7a5
commit 9a3b123e65

View file

@ -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") ||