Skip to content

Commit

Permalink
When back option is clicked in Reset password screen the user is redi…
Browse files Browse the repository at this point in the history
…rected to Otp screen with Resend Otp timer running.

Signed-off-by: Sreang Rathanak <[email protected]>
  • Loading branch information
Sreang Rathanak authored and ase-101 committed Jan 31, 2024
1 parent 52161c1 commit b04a97f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MouseEvent, useCallback, useMemo, useState } from "react";
import { useFormContext, UseFormReturn } from "react-hook-form";
import { Trans, useTranslation } from "react-i18next";
import { useLocation } from "react-router-dom";
import { useNavigate } from "react-router-dom";

import { IconLabelPopover } from "~components/icon-label-popover";
import { ActionMessage } from "~components/ui/action-message";
Expand Down Expand Up @@ -49,6 +49,7 @@ interface ResetPasswordProps {

export const ResetPassword = ({ methods, settings }: ResetPasswordProps) => {
const { t } = useTranslation();
const navigate = useNavigate();

const { control, setValue, getValues } = useFormContext();
const [passwordResetError, setPasswordResetError] = useState<Error | null>(
Expand Down Expand Up @@ -77,9 +78,8 @@ export const ResetPassword = ({ methods, settings }: ResetPasswordProps) => {
const { resetPasswordMutation } = useResetPassword();

const handleBack = useCallback(() => {
setValue("otp", "", { shouldValidate: true });
setStep(ResetPasswordStep.Otp);
}, [step, setStep, setValue]);
navigate(0)
}, []);

const disabledContinue =
!isResetPasswordValid ||
Expand Down

0 comments on commit b04a97f

Please sign in to comment.