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

/**
 *宁博活动-列表
 */

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

      dispatch({ type: "A6/getList", payload: obj });
    }
  };
};

/**
 * 宁博活动-删除
 */
export const A6_APIdel = (id: number) => {
  return http.get(`cms/activity/removes/${id}`);
};

/**
 * 宁博活动-获取详情
 */
export const A6_APIgetInfo = (id: number) => {
  return http.get(`cms/activity/detail/${id}`);
};

/**
 * 宁博活动-新增、编辑
 */
export const A6_APIsave = (data: any) => {
  return http.post("cms/activity/save", data);
};
