update login and verify otp
This commit is contained in:
@@ -27,9 +27,10 @@ const theme = {
|
||||
};
|
||||
|
||||
export default function LoginScreen() {
|
||||
|
||||
const navigation = useNavigation<StackNavigationProp<RootStackParamList>>();
|
||||
const [mobile, setMobile] = useState("");
|
||||
const navigation = useNavigation<StackNavigationProp<RootStackParamList>>();
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
// animations
|
||||
const fade = useRef(new Animated.Value(0)).current;
|
||||
@@ -43,17 +44,21 @@ export default function LoginScreen() {
|
||||
]).start();
|
||||
}, []);
|
||||
|
||||
const handleContinue = async () => {
|
||||
const handleContinue = async () => {
|
||||
if (mobile.length === 10) {
|
||||
console.log("Mobile submitted:", mobile);
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await axios.get(LOGIN_URL+mobile)
|
||||
console.log('loginres',res.data)
|
||||
if(res.data.statusCode === 200){
|
||||
navigation.navigate('OtpVarify', { mobile: mobile })
|
||||
console.log("Mobile submitted:", mobile);
|
||||
const res = await axios.get(LOGIN_URL + mobile)
|
||||
console.log('loginres', res.data)
|
||||
if (res.data.statusCode === 200) {
|
||||
navigation.navigate('OtpVarify', { mobile: mobile })
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
console.error("Login error:", error);
|
||||
Alert.alert("Error", "Failed to send OTP. Please try again.");
|
||||
}finally {
|
||||
setLoading(false);
|
||||
}
|
||||
} else {
|
||||
Alert.alert("Please enter a valid 10-digit mobile number");
|
||||
|
||||
Reference in New Issue
Block a user