Skip to content

Commit 7679b5b

Browse files
katarina-calaivicac
authored andcommitted
1695-improvement to fix failing test for PasswordResetInit
1 parent d5abc76 commit 7679b5b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

client/src/pages/account/public/PasswordResetInit.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@ export const PasswordResetInit = () => {
2727

2828
const navigate = useNavigate();
2929

30+
const email = form.getValues().email;
31+
3032
useEffect(() => {
31-
if (form.getValues().email && resetPasswordSuccess) {
32-
navigate('/password-reset/email', {state: {email: form.getValues().email}});
33+
if (email && resetPasswordSuccess) {
34+
navigate('/password-reset/email', {state: {email: email}});
3335
} else if (resetPasswordFailure) {
3436
navigate('/account-error');
3537
}
3638

3739
reset();
38-
}, [form, navigate, reset, resetPasswordFailure, resetPasswordSuccess]);
40+
}, [email, navigate, reset, resetPasswordFailure, resetPasswordSuccess]);
3941

4042
function handleSubmit({email}: z.infer<typeof formSchema>) {
4143
resetPasswordInit(email);

0 commit comments

Comments
 (0)