import http from "@/utils/http";
import { AppDispatch } from "..";

/**
 *宁博藏珍-列表
 */

export const A4_APIgetList = (data: any): any => {
  return async (dispatch: AppDispatch) => {
    const res = await http.post("cms/goods/pageList", data);
    if (res.code === 0) {
      const obj = {
        list: res.data.records,
        total: res.data.total,
      };
      dispatch({ type: "A4/getList", payload: obj });
    }
  };
};

/**
 * 宁博藏珍-删除
 */
export const A4_APIdel = (id: number) => {
  return http.get(`cms/goods/removes/${id}`);
};

/**
 * 宁博藏珍-获取详情
 */
export const A4_APIgetInfo = (id: number) => {
  return http.get(`cms/goods/detail/${id}`);
};

/**
 * 宁博藏珍-新增、编辑
 */
export const A4_APIsave = (data: any) => {
  return http.post("cms/goods/save", data);
};

