fix: update middleware to redirect authenticated users to home
Some checks failed
docker-build / docker (pull_request) Successful in 3m48s
container-scan / Container Scan (pull_request) Failing after 1m20s

Automatically redirectis authenticated users from root path ('/') to the '/home' page.
This commit is contained in:
Maximilian Liebmann 2025-05-11 12:07:29 +02:00
parent 3b75166971
commit 220505bcff

View file

@ -8,6 +8,9 @@ export default auth((req) => {
) { ) {
const newUrl = new URL('/login', req.nextUrl.origin); const newUrl = new URL('/login', req.nextUrl.origin);
return Response.redirect(newUrl); return Response.redirect(newUrl);
} else if (req.auth != null && req.nextUrl.pathname === '/') {
const newUrl = new URL('/home', req.nextUrl.origin);
return Response.redirect(newUrl);
} }
}); });