We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 63a4477 commit e287d01Copy full SHA for e287d01
utils/supabase/middleware.ts
@@ -47,6 +47,15 @@ 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 !== '/') {
52
+ const url = request.nextUrl.clone()
53
+ url.pathname = '/auth/signin'
54
+ return NextResponse.redirect(url)
55
+ }
56
+
57
58
59
if (
60
user &&
61
(request.nextUrl.pathname === '/' ||
0 commit comments