import { withAuth } from "next-auth/middleware"; export default withAuth({ pages: { signIn: `/login`, }, callbacks: { authorized: ({ token }) => { if (process.env.SETUP_MODE === "true") { return true; } if (token?.email) { return true; } return false; }, }, }); export const config = { matcher: ["/((?!ws|wss|api|_next/static|_next/image|favicon.ico).*)"], };