export const middleware: NextMiddleware = withMiddlewareAuth({
redirectTo: "/login",
authGuard: {
isPermitted: async (user): Promise<boolean> => {
const res = await supabase.rpc("user_has_any_role", {
user_id_: user.id,
});
return !!res.data;
},
redirectTo: "/unauthorized",
},
});
// See "Matching Paths" below to learn more
export const config = {
matcher: ["/((?!api|_next|fonts|login|unauthorized|[\\w-]+\\.\\w+).*)"],
};
export const middleware: NextMiddleware = withMiddlewareAuth({
redirectTo: "/login",
authGuard: {
isPermitted: async (user): Promise<boolean> => {
const res = await supabase.rpc("user_has_any_role", {
user_id_: user.id,
});
return !!res.data;
},
redirectTo: "/unauthorized",
},
});
// See "Matching Paths" below to learn more
export const config = {
matcher: ["/((?!api|_next|fonts|login|unauthorized|[\\w-]+\\.\\w+).*)"],
};