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

/**
 *宁博文创-列表
 */

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

/**
 * 宁博文创-删除
 */
export const A3_APIdel = (id: number) => {
  return http.get(`cms/cultural/removes/${id}`);
};

/**
 * 宁博文创-获取详情
 */
export const A3_APIgetInfo = (id: number) => {
  return http.get(`cms/cultural/detail/${id}`);
};

/**
 * 宁博文创-新增、编辑
 */
export const A3_APIsave = (data: any) => {
  return http.post("cms/cultural/save", data);
};

/**
 * 宁博文创-编辑-商城状态
 */
export const A3_APIsetCon = (display: 0 | 1) => {
  return http.get(`cms/cultural/editConfig/${display}`);
};

/**
 * 宁博文创-获取-商城状态
 */
export const A3_APIgetCon = () => {
  return http.get("cms/cultural/getConfig");
};
