Skip to content

Commit

Permalink
chore(web): testing out a middleware redirect method
Browse files Browse the repository at this point in the history
  • Loading branch information
ixahmedxi committed Jul 31, 2023
1 parent dce1753 commit a742108
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/web/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export default authMiddleware({
return NextResponse.redirect(new URL('/app', req.url));
}

if (!auth.userId && req.nextUrl.pathname.includes('/app')) {
return NextResponse.redirect(new URL('/', req.url));
}

return NextResponse.next();
},
publicRoutes: [
Expand Down

0 comments on commit a742108

Please sign in to comment.