diff --git a/src/screens/AuthScreen/Login/index.js b/src/screens/AuthScreen/Login/index.js index d936477..64c0d01 100644 --- a/src/screens/AuthScreen/Login/index.js +++ b/src/screens/AuthScreen/Login/index.js @@ -19,7 +19,7 @@ import Geolocation from '@react-native-community/geolocation'; const Login = ({ navigation }) => { const [loading, setLoading] = useState(false); const dispatch = useDispatch(); - const [username, setUsername] = useState('testah'); + const [username, setUsername] = useState(''); // geo loc @@ -32,9 +32,6 @@ const Login = ({ navigation }) => { const onSubmit = () => { setLoading(true); getOTP(); - setTimeout(() => { - setLoading(false); - }, 100); }; const getOTP = async () => { @@ -57,14 +54,17 @@ const Login = ({ navigation }) => { const res = response.data || []; console.log('OTP is ===> ', res?.SendOTP); if (res?.SendOTP[0].OTP === '0' || res?.SendOTP[0].OTP === 0) { + setLoading(false); toastError("Alert", "Invalid User"); } else { toastSuccess("Alert", res?.SendOTP[0]?.Messages); navigation.navigate('VerifyOTP', { username: username }); + setLoading(false); } // console.log('getotpApi res==>', JSON.stringify(res?.SendOTP[0])); } catch (error) { console.log("❌ OTP API error:", error); + setLoading(false); } };