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')} onEditValue={() => setCurrentStep('emailOrPhone')}
onLoginWithOTP={() => setCurrentStep('verify')} onLoginWithOTP={() => setCurrentStep('verify')}
emailOrPhone={loginRegisterValue} emailOrPhone={loginRegisterValue}
setTimerValue={setTimerValue}
/> />
)} )}

View File

@@ -39,6 +39,7 @@ export interface EnterPasswordFormProps {
loginRegisterValue: string; loginRegisterValue: string;
countryCode: CountryCode; countryCode: CountryCode;
authFactory: AuthFactory; authFactory: AuthFactory;
setTimerValue: (value: number) => void;
} }
export const EnterPasswordForm = ({ export const EnterPasswordForm = ({
@@ -50,6 +51,7 @@ export const EnterPasswordForm = ({
loginRegisterValue, loginRegisterValue,
countryCode, countryCode,
authFactory, authFactory,
setTimerValue,
}: EnterPasswordFormProps) => { }: EnterPasswordFormProps) => {
const { t, i18n } = useTranslation('authentication'); const { t, i18n } = useTranslation('authentication');
const [passValue, setPassValue] = useState<string>(''); const [passValue, setPassValue] = useState<string>('');
@@ -106,7 +108,10 @@ export const EnterPasswordForm = ({
const handleLoginWithOtp = async () => { const handleLoginWithOtp = async () => {
if (authType === 'phone') { if (authType === 'phone') {
await smsResendCall({ phoneNumber: countryCode + loginRegisterValue }); const data = await smsResendCall({
phoneNumber: countryCode + loginRegisterValue,
});
setTimerValue(data?.totalSecondForOtpToExpire ?? 120);
} else { } else {
await emailResendCall({ email: loginRegisterValue }); await emailResendCall({ email: loginRegisterValue });
} }

View File

@@ -53,6 +53,7 @@ export interface SendSmsOtpRequest {
export interface SendSmsOtpResponse extends ApiResponse { export interface SendSmsOtpResponse extends ApiResponse {
totalSecondForCodeToExpire: number; totalSecondForCodeToExpire: number;
totalSecondForOtpToExpire: number;
} }
// SendEmailOtp // SendEmailOtp
@@ -117,5 +118,4 @@ export interface LoginOrSignUpWithGoogleRequest {
} }
export interface LoginOrSignUpWithGoogleResponse export interface LoginOrSignUpWithGoogleResponse
extends ApiResponse, extends ApiResponse, LoginResult {}
LoginResult {}