We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 00c991e commit 9fbda59Copy full SHA for 9fbda59
utils/supabase/middleware.ts
@@ -47,8 +47,10 @@ export async function updateSession(request: NextRequest) {
47
// return NextResponse.redirect(url)
48
// }
49
50
- //if no user and user try to hit any route other than /auth/signin or /auth/signup or /, redirect to /auth/signin
51
- if (!user && !request.nextUrl.pathname.startsWith('/auth/signin') && !request.nextUrl.pathname.startsWith('/auth/signup') && request.nextUrl.pathname !== '/') {
+ if (
+ !user && (request.nextUrl.pathname.startsWith('/dashboard'))
52
+ ) {
53
+ // no user, potentially respond by redirecting the user to the login page
54
const url = request.nextUrl.clone()
55
url.pathname = '/auth/signin'
56
return NextResponse.redirect(url)
0 commit comments