import http from "@/utils/http";
import { AppDispatch } from "..";
/**
 * 获取列表
 */
export const A1_APIgetList = (data: any) => {
  return async (dispatch: AppDispatch) => {
    const res = await http.post("cms/book/pageList", data);
    if (res.code === 0) {
      const obj = {
        list: res.data.records,
        total: res.data.total,
      };

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

/**
 * 导出
 */
export const A1_APIlistExport = (data: any) => {
  return http.post("cms/book/pageList", data);
};

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