-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmiddleware.ts
More file actions
22 lines (20 loc) · 797 Bytes
/
middleware.ts
File metadata and controls
22 lines (20 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import NextAuth from "next-auth";
import { authConfig } from "./auth.config";
import { NextRequest, NextResponse } from "next/server";
// Custom middleware to allow /seed without auth
export function middleware(req: NextRequest) {
// Allow /seed route without authentication
if (req.nextUrl.pathname.startsWith("/seed")) {
return NextResponse.next();
}
// Otherwise, use NextAuth middleware
// @ts-expect-error: NextAuth middleware typing is not compatible with NextRequest here
return NextAuth(authConfig).auth(req);
}
export const config = {
// https://nextjs.org/docs/app/building-your-application/routing/middleware#matcher
// matcher: [
// "/((?!api|_next/static|_next/image|data|login|CDTphotos|.*\\.png$|$).*)",
// ],
matcher: ["/journal/listView/:path*"],
};