Requeste api implelented

This commit is contained in:
Jaanu423
2025-09-17 16:24:06 +05:30
parent a931f886b2
commit dd603dcff7
13 changed files with 921 additions and 303 deletions
+5 -41
View File
@@ -1,4 +1,4 @@
import React, { useState, useEffect, useCallback } from "react";
import React, { useState, useEffect, useCallback, use } from "react";
import {
StyleSheet,
View,
@@ -22,7 +22,7 @@ import SwitchNavigator from "./SwitchNavigator";
import { useFocusEffect } from "@react-navigation/native";
import { ApiResponse } from "../home/UserProfileStatus";
import { BASE_URL } from "../../utils/ApiUrls";
import AppView from "../../components/AppView";
type UserProfile = {
@@ -241,38 +241,6 @@ const Profile = () => {
};
const handleLogout = (navigation: any) => {
Alert.alert(
"Logout",
"Are you sure you want to logout?",
[
{
text: "Cancel",
style: "cancel",
},
{
text: "Yes, Logout",
style: "destructive",
onPress: async () => {
try {
// Clear saved credentials from Keychain
await Keychain.resetGenericPassword();
// Navigate to login screen
navigation.reset({
index: 0,
routes: [{ name: "Login" }],
});
} catch (error) {
console.error("Logout error:", error);
Alert.alert("Error", "Failed to logout. Please try again.");
}
},
},
],
{ cancelable: true }
);
};
useFocusEffect(
useCallback(() => {
@@ -280,8 +248,6 @@ const Profile = () => {
}, [])
);
console.log("login user data :", user);
useEffect(() => {
fetchUserProfile();
}, []);
@@ -308,9 +274,7 @@ const Profile = () => {
}
return (
<View style={styles.container}>
<StatusBar barStyle="light-content" />
<AppView>
{/* Header */}
<View style={styles.header}>
<Text style={styles.headerTitle}>User Profile</Text>
@@ -507,7 +471,7 @@ const Profile = () => {
</View>
</ScrollView>
</KeyboardAvoidingView>
</View>
</AppView>
);
};
@@ -533,7 +497,7 @@ const styles = StyleSheet.create({
justifyContent: "space-between",
alignItems: "center",
padding: 16,
paddingTop: 50,
// paddingTop: 50,
// backgroundColor: "#6366f1",
borderBottomLeftRadius: 20,
borderBottomRightRadius: 20,