Requeste api implelented
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user