fix: update middleware to redirect authenticated users to home
Automatically redirectis authenticated users from root path ('/') to the '/home' page.
This commit is contained in:
parent
8e3786ae6b
commit
8298dbba28
1 changed files with 3 additions and 0 deletions
|
@ -8,6 +8,9 @@ export default auth((req) => {
|
|||
) {
|
||||
const newUrl = new URL('/login', req.nextUrl.origin);
|
||||
return Response.redirect(newUrl);
|
||||
} else if (req.auth != null && req.nextUrl.pathname === '/') {
|
||||
const newUrl = new URL('/home', req.nextUrl.origin);
|
||||
return Response.redirect(newUrl);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue