import request from '@/utils/request'
const url = '/api/cates'

export function index(page = 1, pageSize = 10) {
  return request({
    url: url,
    method: 'get',
    params: {
      page,
      pageSize
    }
  })
}

export function show(id) {
  return request({
    url: url + '/${id}',
    method: 'get'
  })
}

export function store(data) {
  return request({
    url: '${url}',
    method: 'post',
    data
  })
}

export function update(data) {
  data = JSON.stringify(data)
  return request({
    url: '${url}/${data.id}',
    method: 'patch',
    data,
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

export function destroy(id) {
  return request({
    url: '/api/cates/id',
    method: 'delete'

  })
}

export function upload(data) {
  return request({
    url: '${url}/${id}',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data
  })
}
