fix: add setTimerValue prop to EnterPasswordForm and update OTP handling
This commit is contained in:
@@ -190,6 +190,7 @@ export const AuthenticationSteps = (): JSX.Element => {
|
||||
onEditValue={() => setCurrentStep('emailOrPhone')}
|
||||
onLoginWithOTP={() => setCurrentStep('verify')}
|
||||
emailOrPhone={loginRegisterValue}
|
||||
setTimerValue={setTimerValue}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
Reference in New Issue
Block a user