import http from "@/utils/http";
import { AppDispatch } from "..";
/**
 * 获取 馆藏管理列表
 */
export const A5_APIgetList = (data: 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: "A5/getList", payload: obj });
    }
  };
};

/**
 * 删除
 */
export const A5_APIdel = (id: number) => {
  return http.get(`cms/goods/remove/${id}`);
};

/**
 * 获取详情
 */
export const A5_APIgetInfo = (id: number) => {
  return http.get(`cms/goods/detail/${id}`);
};

/**
 * 新增/编辑
 */
export const A5_APIsave = (data: any) => {
  return http.post("cms/goods/save", data);
};
