mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
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:
@@ -47,7 +47,7 @@ export async function changePassword(password: string) {
|
||||
}
|
||||
|
||||
await supabase.auth.signOut({ scope: "global" });
|
||||
redirect("/login");
|
||||
return undefined;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user