link-stack/apps/bridge-frontend/middleware.ts
2024-04-23 13:36:51 +02:00

24 lines
432 B
TypeScript

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).*)"],
};