reza fixed address delete

master
Reza_ashrafi 2 years ago
parent de907b9453
commit be780c908e
  1. 5
      src/redux/actions/userAddress.js
  2. 4
      src/redux/proxy.js
  3. 2
      src/redux/reducers/userAddress.js
  4. 6
      src/screens/Profile/components/ProfileAddress/index.js

@ -14,7 +14,7 @@ const userAddress = {
update:
(data = {}, data2 = {}) =>
async (dispatch) => {
await proxy.put("userAddress/update", data);
await proxy.put("userAddress/update", data, {dispatch });
},
add:
(data = {}, data2 = {}, data3 = {}) =>
@ -24,8 +24,7 @@ const userAddress = {
del:
(data = {}, data2 = {}) =>
async (dispatch) => {
console.log(data);
await proxy.delete("userAddress/delete2", data);
await proxy.delete("userAddress/delete", data, {dispatch });
},
};

@ -50,7 +50,9 @@ class Proxy {
() => Axios.delete(url, { ...opt, data: params }),
data || params
);
} catch (error) {}
} catch (error) {
console.log('error "proxy.js" axios.delete');
}
};
check = async (url, { dispatch }, fetch, params) => {

@ -21,7 +21,7 @@ export default function userAddress(state = initialState, action) {
return { ...state, loading: false, list: data, error: null };
case "userAddress/add":
return { ...state, loading: false, list: data.list, error: null };
case "userAddress/delete2":
case "userAddress/delete":
return { ...state, loading: false, list: data, error: null };
case "userAddress/loading":
return { ...state, loading: true };

@ -14,13 +14,11 @@ import React from "react";
import { connect } from "react-redux";
import { asyncAwesomeAlert } from "../../../../utils/AsyncWrappers";
import { useNavigation } from "@react-navigation/native";
import { Ionicons, Entypo } from "@expo/vector-icons";
import { Ionicons } from "@expo/vector-icons";
import { userAddress, userFactor } from "../../../../redux/actions";
import Svg, { G, Path } from "react-native-svg";
//components
import Navbar from "../../../../components/Navbar";
import CustomPressable from "../../../../components/Pressable";
import Empty from "../../../../components/Empty";
//style
@ -248,7 +246,7 @@ const ProfileAddress = ({
showCancelButton: true,
confirmText: "بله",
cancelText: "لغو",
onConfirm: () => deleteItem({ id: address?.id }),
onConfirm: () => deleteItem({ id : address?.id }),
})
}
>

Loading…
Cancel
Save