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')}
|
onEditValue={() => setCurrentStep('emailOrPhone')}
|
||||||
onLoginWithOTP={() => setCurrentStep('verify')}
|
onLoginWithOTP={() => setCurrentStep('verify')}
|
||||||
emailOrPhone={loginRegisterValue}
|
emailOrPhone={loginRegisterValue}
|
||||||
|
setTimerValue={setTimerValue}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -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 });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 {}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user