import proxy from "../proxy";
const userProduct = {
  list:
    (data = {}) =>
    async (dispatch) => {
      await proxy.get("userProduct/list", data, { dispatch });
    },
  info:
    (data = {}) =>
    async (dispatch) =>
      await proxy.get("userProduct/info", data, { dispatch }),
  update:
    (data = {}, data2 = {}) =>
    async (dispatch) => {
      await proxy.put("userProduct/update", data);
      await proxy.get("userProduct/list", data2, { dispatch });
    },
  add:
    (data = {}, data2 = {}, data3 = {}) =>
    async (dispatch) => {
      await proxy.post("userProduct/add", data, { dispatch });
      await proxy.get("userProduct/list", data2, { dispatch });
      await proxy.get("userFactor/info", data3, { dispatch });
    },
  del:
    (data = {}, data2 = {}) =>
    async (dispatch) => {
      await proxy.delete("userProduct/delete", data);
      await proxy.get("userProduct/list", data2, { dispatch });
    },
  myList:
    (data = {}) =>
    async (dispatch) => {
      await proxy.get("userProduct/myList", data, { dispatch });
    },
};

export default userProduct;