import service from '@/utils/service'

const baseUrl = process.env.VUE_APP_HOST + '/manager/api/cp'

const cpApi = {}

cpApi.baseUrl = baseUrl

cpApi.getList = params => {
  return service({
    url: `${baseUrl}/v1/list`,
    method: 'get',
    params: params
  })
}

cpApi.getById = id => {
  return service({
    url: `${baseUrl}/v1/${id}`,
    method: 'get',
  })
}

cpApi.add = data => {
  return service({
    url: `${baseUrl}/v1`,
    method: 'post',
    data: data
  })
}

cpApi.update = data => {
  return service({
    url: `${baseUrl}/v1`,
    method: 'put',
    data: data
  })
}

export default cpApi