with helper funtion

This commit is contained in:
Abin Toppo
2025-09-19 13:39:04 +05:30
parent 4de484c0a5
commit d4a1866f34
8 changed files with 314 additions and 316 deletions
+7 -1
View File
@@ -18,9 +18,12 @@ import {
} from "react-native";
import { RootStackParamList } from "../navigation/AppNavigator";
import * as Keychain from "react-native-keychain";
import { LOGIN_URL, VARIFY_OTP_URL } from "../utils/ApiUrls";
import { BASE_URL, LOGIN_URL, VARIFY_OTP_URL } from "../utils/ApiUrls";
import { StackNavigationProp } from "@react-navigation/stack";
import colors from "../components/colors";
import { useDispatch } from "react-redux";
import { setUserData } from "../redux/userSlice";
import { fetchUserProfile } from "../utils/HelperFunction";
const theme = {
primary: "#111111",
@@ -47,6 +50,7 @@ export default function OtpVerificationScreen() {
const slide = useRef(new Animated.Value(24)).current;
const ctaScale = useRef(new Animated.Value(1)).current;
useEffect(() => {
Animated.parallel([
Animated.timing(fade, { toValue: 1, duration: 600, useNativeDriver: true }),
@@ -74,6 +78,7 @@ export default function OtpVerificationScreen() {
}
};
const onSubmit = async (otp: string, mobile: string) => {
try {
const payload = { mobile, otp };
@@ -86,6 +91,7 @@ export default function OtpVerificationScreen() {
console.log("✅ OTP Verified:", res.data);
if (res.data.statusCode === 200) {
saveToken(res.data.data);
fetchUserProfile()
navigation.navigate('Home')
ToastAndroid.show("OTP Verified Successfully!", ToastAndroid.SHORT);
}