update login and verify otp

This commit is contained in:
Jaanu423
2025-09-15 11:18:39 +05:30
parent a26b6f5e7a
commit 737c3a486e
4 changed files with 545 additions and 179 deletions
+14 -9
View File
@@ -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");