diff --git a/ProtectedRouter.tsx b/ProtectedRouter.tsx index ce14f53e..2f9849b4 100644 --- a/ProtectedRouter.tsx +++ b/ProtectedRouter.tsx @@ -13,6 +13,7 @@ import userData from './src/data/userData.json'; import {getUniqueId} from 'react-native-device-info'; import {useAppDispatch} from './src/hooks'; import {setAuthData} from './src/reducer/commonSlice'; +import { _map } from './RN-UI-LIB/src/utlis/common'; const Stack = createNativeStackNavigator(); @@ -50,7 +51,7 @@ const ProtectedRouter = () => { header: () => null, }} /> - {Object.keys(data.widgets).map(key => ( + {_map(data.widgets, key => ( { + // TODO: Fix status from BE if (err.response.status === 404) { dispatch( - setGetOTPError('Enter a registered mobile number'), + setOTPError('Enter a registered mobile number'), ); } else { - dispatch(setGetOTPError(err.response?.data?.message)); + dispatch(setOTPError(err.response?.data?.message)); } }); }; diff --git a/src/components/countdown/index.tsx b/src/components/countdown/index.tsx index 68b98b2e..83844f75 100644 --- a/src/components/countdown/index.tsx +++ b/src/components/countdown/index.tsx @@ -26,11 +26,11 @@ export const Countdown = (props: CountdownProps) => { if (newTickerValue < stopAt) { clearTimeout(intervalRef.current); - onComplete && onComplete(); + onComplete && typeof onComplete === 'function' && onComplete(); return; } - step && step(newTickerValue); + step && typeof onComplete === 'function' && step(newTickerValue); setTicker(newTickerValue); }; diff --git a/src/components/login/OtpText.tsx b/src/components/login/OtpText.tsx index 2fb4c974..16a12df1 100644 --- a/src/components/login/OtpText.tsx +++ b/src/components/login/OtpText.tsx @@ -20,6 +20,10 @@ const OtpText = () => { dispatch(generateOTP({phoneNumber}, true)); }; + const handleCountdownComplete = () => { + setCountDownComplete(true) + }; + if (verifyOTPError) { return ( @@ -44,12 +48,10 @@ const OtpText = () => { Resend OTP in{' '} { - setCountDownComplete(true); - }} + onComplete={handleCountdownComplete} startFrom={30} />{' '} - second + second(s) ); }; diff --git a/src/components/login/index.tsx b/src/components/login/index.tsx index efb87725..7fff4c24 100644 --- a/src/components/login/index.tsx +++ b/src/components/login/index.tsx @@ -52,7 +52,7 @@ const Login = () => { keyboardType="phone-pad" placeholder="Enter here" onBlur={onBlur} - onChangeText={value => onChange(value)} + onChangeText={onChange} value={value} maxLength={10} defaultValue={phoneNumber} @@ -61,7 +61,7 @@ const Login = () => { /> )} name="phoneNumber" - rules={{required: true, minLength: 10}} + rules={{required: true, minLength: 10, maxLength: 10}} />