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/rank/getList', data)
    if (res.code === 0) {
      dispatch({ type: 'A3/getList', payload: res.data })
    }
  }
}

// 获取新增 、编辑 里面的 书名/ISBN编号的下拉框数据
export const A1_APIgetSelect = (): any => {
  return http.post('cms/book/pageList', {
    pageNum: 1,
    pageSize: 99999
  })
}

/**
 * 图书推荐-删除
 */
export const A3_APIdel = (id: number) => {
  return http.get(`cms/rank/remove/${id}`)
}

/**
 * 图书推荐-获取详情
 */
export const A3_APIgetInfo = (id: number) => {
  return http.get(`cms/rank/detail/${id}`)
}

/**
 * 图书推荐-新增、编辑
 */
export const A3_APIsave = (data: any) => {
  return http.post('cms/rank/save', data)
}
