import http from '@/utils/http'
import { AppDispatch } from '..'
import { A6AddType } from '@/types/api/A6exhibition'

/**
 * 展览-列表
 */
export const A6_APIgetList = (data: any): any => {
  return async (dispatch: AppDispatch) => {
    const res = await http.post('museum/exhibit/page', 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.post(`museum/exhibit/del/${id}`)
}

/**
 * 活动-获取详情
 */
export const A6_APIgetInfo = (id: number) => {
  return http.post(`museum/exhibit/info/${id}`)
}

/**
 * 活动 新增
 */
export const A6_APIadd = (data: A6AddType) => {
  return http.post('museum/exhibit/add', data)
}

/**
 * 活动 修改
 */
export const A6_APIedit = (data: A6AddType) => {
  return http.post('museum/exhibit/edit', data)
}

/**
 * 活动-发布
 */
export const A6_APIpublish = (id: number) => {
  return http.post(`museum/exhibit/publish`, { exhibitId: id })
}
