correct issues
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
TouchableOpacity,
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
ToastAndroid,
|
||||
} from "react-native";
|
||||
import { useNavigation, useFocusEffect, useRoute, RouteProp } from "@react-navigation/native";
|
||||
import { StackNavigationProp } from "@react-navigation/stack";
|
||||
@@ -102,13 +103,14 @@ const ManagementScreen: FC = () => {
|
||||
// No need to set loading here if the whole screen is already loading
|
||||
const res = await apiCall(url, "PUT", {}) as ApiResponse<null> | null;
|
||||
if (res && res.statusCode === 200) {
|
||||
Alert.alert("Success", res.message || successMessage);
|
||||
ToastAndroid.show("Success", ToastAndroid.SHORT);
|
||||
fetchData(); // Refresh data after action
|
||||
} else {
|
||||
throw new Error(res?.message || failureMessage);
|
||||
}
|
||||
} catch (err: any) {
|
||||
// Alert.alert("Error", err.message || "An unexpected error occurred.");
|
||||
console.error("Action Error:", err);
|
||||
ToastAndroid.show(err.message || failureMessage, ToastAndroid.SHORT);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user