fix: update middleware to redirect authenticated users to home
All checks were successful
container-scan / Container Scan (pull_request) Successful in 2m31s
docker-build / docker (pull_request) Successful in 7m43s

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 8e3786ae6b
commit 8298dbba28

View file

@ -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);
}
});