fix(frontend): redirect to login client-side after password change

The server action used redirect('/login') which throws a Next.js
internal error, leaving the form stuck in a loading state during
the transition. Move the redirect to the client side with
router.push('/login') so setIsLoading(false) is properly reached
on error, and the navigation happens cleanly after the success toast.
This commit is contained in:
Otto (AGPT)
2026-03-12 14:53:51 +00:00
parent 57e916b5ca
commit a76dbaa35e
2 changed files with 4 additions and 3 deletions

View File

@@ -47,7 +47,7 @@ export async function changePassword(password: string) {
}
await supabase.auth.signOut({ scope: "global" });
redirect("/login");
return undefined;
},
);
}

View File

@@ -129,8 +129,8 @@ function ResetPasswordContent() {
}
const error = await changePassword(data.password);
setIsLoading(false);
if (error) {
setIsLoading(false);
toast({
title: "Error",
description: error,
@@ -143,8 +143,9 @@ function ResetPasswordContent() {
description: "Password changed successfully. Redirecting to login.",
variant: "default",
});
router.push("/login");
},
[changePasswordForm, toast],
[changePasswordForm, toast, router],
);
if (isUserLoading) {