feat: redirect user dynamically based on role instead of /protected after login
All checks were successful
Staging Build / build (push) Successful in 2m14s

This commit is contained in:
DanielS
2026-06-24 00:23:51 +02:00
parent 62e3c7804a
commit 615b0719f1
4 changed files with 11 additions and 7 deletions

View File

@@ -32,9 +32,12 @@ export function LoginForm({
setError(null);
try {
await signIn(email, password);
// Update this route to redirect to an authenticated route. The user already has an active session.
router.push("/protected");
const res = await signIn(email, password);
if (res.role === "admin") {
router.push("/admin/einstellungen");
} else {
router.push("/my-customers");
}
} catch (error: unknown) {
setError(error instanceof Error ? error.message : "An error occurred");
} finally {