Neah/middleware.ts
2025-04-17 13:12:00 +02:00

31 lines
732 B
TypeScript

import { withAuth } from "next-auth/middleware";
import { NextResponse } from "next/server";
export default withAuth(
function middleware(req) {
// Add custom middleware logic here if needed
return NextResponse.next();
},
{
callbacks: {
authorized: ({ token }) => !!token,
},
pages: {
signIn: "/signin",
},
}
);
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - api/auth (auth endpoints)
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
* - public folder
*/
"/((?!api/auth|_next/static|_next/image|favicon.ico|public).*)",
],
};