-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmiddleware.ts
More file actions
30 lines (27 loc) · 789 Bytes
/
middleware.ts
File metadata and controls
30 lines (27 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { withAuth, NextRequestWithAuth } from "next-auth/middleware";
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
const authMiddleware = withAuth({ pages: { signIn: "/login" } });
export default function middleware(
req: NextRequest,
event: Parameters<typeof authMiddleware>[1]
) {
if (process.env.DISABLE_AUTH === "true") {
return NextResponse.next();
}
return authMiddleware(req as NextRequestWithAuth, event);
}
export const config = {
matcher: [
"/dashboard/:path*",
"/update/:path*",
"/snapshots/:path*",
"/categories/:path*",
"/settings/:path*",
"/api/categories/:path*",
"/api/line-items/:path*",
"/api/snapshots/:path*",
"/api/export/:path*",
"/api/account/:path*",
],
};