feat: handle redirects for admin in /order page and implement next query param on login
All checks were successful
Staging Build / build (push) Successful in 2m19s
All checks were successful
Staging Build / build (push) Successful in 2m19s
This commit is contained in:
@@ -31,12 +31,14 @@ export function LoginForm({
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
|
||||
const nextParam = typeof window !== 'undefined' ? new URLSearchParams(window.location.search).get('next') : null;
|
||||
|
||||
try {
|
||||
const res = await signIn(email, password);
|
||||
if (res.role === "admin") {
|
||||
router.push("/admin/einstellungen");
|
||||
} else {
|
||||
router.push("/my-customers");
|
||||
router.push(nextParam || "/my-customers");
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
setError(error instanceof Error ? error.message : "An error occurred");
|
||||
|
||||
Reference in New Issue
Block a user