From f5aa15902057fec20f3f35a17b863fae95ec3ac2 Mon Sep 17 00:00:00 2001 From: Amir Moghani Date: Thu, 11 Jun 2026 21:20:49 +0330 Subject: [PATCH] fix: add setTimerValue prop to EnterPasswordForm and update OTP handling --- .../components/AuthenticationSteps/AuthenticationSteps.tsx | 1 + .../components/AuthenticationSteps/EnterPasswordForm.tsx | 7 ++++++- src/features/authentication/types/userTypes.ts | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/features/authentication/components/AuthenticationSteps/AuthenticationSteps.tsx b/src/features/authentication/components/AuthenticationSteps/AuthenticationSteps.tsx index 0f5991d..293343d 100644 --- a/src/features/authentication/components/AuthenticationSteps/AuthenticationSteps.tsx +++ b/src/features/authentication/components/AuthenticationSteps/AuthenticationSteps.tsx @@ -190,6 +190,7 @@ export const AuthenticationSteps = (): JSX.Element => { onEditValue={() => setCurrentStep('emailOrPhone')} onLoginWithOTP={() => setCurrentStep('verify')} emailOrPhone={loginRegisterValue} + setTimerValue={setTimerValue} /> )} diff --git a/src/features/authentication/components/AuthenticationSteps/EnterPasswordForm.tsx b/src/features/authentication/components/AuthenticationSteps/EnterPasswordForm.tsx index 5b1bff4..40f982c 100644 --- a/src/features/authentication/components/AuthenticationSteps/EnterPasswordForm.tsx +++ b/src/features/authentication/components/AuthenticationSteps/EnterPasswordForm.tsx @@ -39,6 +39,7 @@ export interface EnterPasswordFormProps { loginRegisterValue: string; countryCode: CountryCode; authFactory: AuthFactory; + setTimerValue: (value: number) => void; } export const EnterPasswordForm = ({ @@ -50,6 +51,7 @@ export const EnterPasswordForm = ({ loginRegisterValue, countryCode, authFactory, + setTimerValue, }: EnterPasswordFormProps) => { const { t, i18n } = useTranslation('authentication'); const [passValue, setPassValue] = useState(''); @@ -106,7 +108,10 @@ export const EnterPasswordForm = ({ const handleLoginWithOtp = async () => { if (authType === 'phone') { - await smsResendCall({ phoneNumber: countryCode + loginRegisterValue }); + const data = await smsResendCall({ + phoneNumber: countryCode + loginRegisterValue, + }); + setTimerValue(data?.totalSecondForOtpToExpire ?? 120); } else { await emailResendCall({ email: loginRegisterValue }); } diff --git a/src/features/authentication/types/userTypes.ts b/src/features/authentication/types/userTypes.ts index 125a852..7174b50 100644 --- a/src/features/authentication/types/userTypes.ts +++ b/src/features/authentication/types/userTypes.ts @@ -53,6 +53,7 @@ export interface SendSmsOtpRequest { export interface SendSmsOtpResponse extends ApiResponse { totalSecondForCodeToExpire: number; + totalSecondForOtpToExpire: number; } // SendEmailOtp @@ -117,5 +118,4 @@ export interface LoginOrSignUpWithGoogleRequest { } export interface LoginOrSignUpWithGoogleResponse - extends ApiResponse, - LoginResult {} + extends ApiResponse, LoginResult {}