import axios from '../bc-libs/api.request'

/**
 * 根据参数查询列表
 * @param parmas
 * @returns {*|void|ClientRequest|ClientHttp2Stream|never|AxiosPromise<any>}
 */
export const getBaseSeniorList = params => {
  return axios.request({
      url: '/api/v1/baseSenior/list',
      params: params,
      method: 'get'
    })
}

/**
 * 根据参数查询列表
 * @param parmas
 * @returns {*|void|ClientRequest|ClientHttp2Stream|never|AxiosPromise<any>}
 */
export const getBaseSeniorPage = params => {
  return axios.request({
    url: '/api/v1/baseSenior/page',
    params: params,
    method: 'get'
  })
}

/**
 * 新增
 * @param params
 * @returns {Promise<any>}
 */
export const addBaseSenior = (params) => {
  return new Promise((resolve, reject) => {
    axios.request({
      url: '/api/v1/baseSenior/add',
      method: 'POST',
      data: params
    }).then(response => {
      resolve(response.data)
    }).catch(err => {
      reject(err)
    })
  })
}

/**
 * 修改
 * @param params
 * @returns {Promise<any>}
 */
export const editBaseSenior = (params) => {
  return new Promise((resolve, reject) => {
    axios.request({
      url: '/api/v1/baseSenior/merge',
      method: 'POST',
      data: params
    }).then(response => {
      resolve(response.data)
    }).catch(err => {
      reject(err)
    })
  })
}

/**
 * 删除
 * @param id
 * @returns {Promise<any>}
 */
export const deleteBaseSenior = (id) => {
  return new Promise((resolve, reject) => {
    axios.request({
      url: '/api/v1/baseSenior/delete/' + id,
      method: 'POST'
    }).then(response => {
      resolve(response.data)
    }).catch(err => {
      reject(err)
    })
  })
}
