fix: add setTimerValue prop to EnterPasswordForm and update OTP handling

This commit is contained in:
2026-06-11 21:20:49 +03:30
parent 1bc82494aa
commit f5aa159020
3 changed files with 9 additions and 3 deletions

View File

@@ -190,6 +190,7 @@ export const AuthenticationSteps = (): JSX.Element => {
onEditValue={() => setCurrentStep('emailOrPhone')}
onLoginWithOTP={() => setCurrentStep('verify')}
emailOrPhone={loginRegisterValue}
setTimerValue={setTimerValue}
/>
)}

View File

@@ -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<string>('');
@@ -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 });
}

View File

@@ -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 {}