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

/**
 *志愿者之家-列表
 */

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

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

/**
 * 志愿者之家-删除
 */
export const A7_APIdel = (id: number) => {
  return http.get(`cms/volunteer/removes/${id}`);
};

/**
 * 志愿者之家-获取详情
 */
export const A7_APIgetInfo = (id: number) => {
  return http.get(`cms/volunteer/detail/${id}`);
};

/**
 * 志愿者之家-新增、编辑
 */
export const A7_APIsave = (data: any) => {
  return http.post("cms/volunteer/save", data);
};
