Files
pedwfrontend/middleware.js
T

38 lines
828 B
JavaScript

// export { default } from "next-auth/middleware";
// export const config = {
// matcher: ["/myportal/", "/myportal/:path*"],
// };
// import { withAuth } from 'next-auth/middleware';
// export default withAuth({
// pages: {
// signIn: '/login',
// },
// });
import { withAuth } from "next-auth/middleware";
export default withAuth({
callbacks: {
authorized: ({ req }) => {
// verify token and return a boolean
const sessionToken = req.cookies.get("next-auth.session-token");
if (sessionToken) return true;
else return false;
},
},
});
export const config = {
matcher: [
"/myportal",
"/myportal/:path*",
"/newappeal",
"/newappeal/:path*",
"/account",
"/account/:path*",
],
};