reza fixed address delete

master
Reza_ashrafi 3 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. 4
      src/screens/Profile/components/ProfileAddress/index.js

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

@ -50,7 +50,9 @@ class Proxy {
() => Axios.delete(url, { ...opt, data: params }), () => Axios.delete(url, { ...opt, data: params }),
data || params data || params
); );
} catch (error) {} } catch (error) {
console.log('error "proxy.js" axios.delete');
}
}; };
check = async (url, { dispatch }, fetch, params) => { 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 }; return { ...state, loading: false, list: data, error: null };
case "userAddress/add": case "userAddress/add":
return { ...state, loading: false, list: data.list, error: null }; return { ...state, loading: false, list: data.list, error: null };
case "userAddress/delete2": case "userAddress/delete":
return { ...state, loading: false, list: data, error: null }; return { ...state, loading: false, list: data, error: null };
case "userAddress/loading": case "userAddress/loading":
return { ...state, loading: true }; return { ...state, loading: true };

@ -14,13 +14,11 @@ import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { asyncAwesomeAlert } from "../../../../utils/AsyncWrappers"; import { asyncAwesomeAlert } from "../../../../utils/AsyncWrappers";
import { useNavigation } from "@react-navigation/native"; 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 { userAddress, userFactor } from "../../../../redux/actions";
import Svg, { G, Path } from "react-native-svg";
//components //components
import Navbar from "../../../../components/Navbar"; import Navbar from "../../../../components/Navbar";
import CustomPressable from "../../../../components/Pressable";
import Empty from "../../../../components/Empty"; import Empty from "../../../../components/Empty";
//style //style

Loading…
Cancel
Save