Skip to content

Commit e987c08

Browse files
committed
feat: remove strict login requirement
1 parent 15af142 commit e987c08

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
/**
22
* Configuration for dashboard routes that require authentication.
3-
*
3+
*
44
* To add a new protected route, simply add the path to this array.
55
* To remove protection from a route, remove it from this array.
6-
*
6+
*
77
* Routes are matched using prefix matching, so nested routes under
88
* a protected path will also be protected (e.g., /dashboard/projects/123
99
* is protected if /dashboard/projects is in this array).
1010
*/
1111
export const PROTECTED_DASHBOARD_ROUTES = [
12-
'/dashboard/projects',
13-
'/dashboard/sheet',
12+
"/dashboard/projects",
13+
"/dashboard/sheet",
1414
] as const;
15-

apps/web/src/middleware.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ export async function middleware(req: NextRequest) {
1111
req: adaptedReq as any,
1212
secret: process.env.NEXTAUTH_SECRET,
1313
});
14-
14+
1515
const pathname = req.nextUrl.pathname;
16-
16+
1717
const isProtectedRoute = PROTECTED_DASHBOARD_ROUTES.some((path) =>
1818
pathname.startsWith(path)
1919
);
20-
20+
2121
if (isProtectedRoute && !token) {
2222
const signInUrl = new URL("/login", req.url);
2323
signInUrl.searchParams.set("callbackUrl", pathname);
2424
return NextResponse.redirect(signInUrl);
2525
}
26-
26+
2727
return NextResponse.next();
2828
}

0 commit comments

Comments
 (0)