import { request } from '@/utils'

export default {
  create: data => request.post('/article', data),
  read: (params = {}) => request.get('/article/page', { params }),
  update: data => request.patch(`/article/${data.id}`, data),
  delete: id => request.delete(`/article/${id}`),
  getOne: id => request.get(`/article/detail/${id}`),
  getAll: data => request.get('/article?enable=1', data),
  up: id => request.post(`/article/up/${id}`),
  down: id => request.post(`/article/down/${id}`),
  uploadImage: data => request.post('/menu/cover/upload', data, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
    timeout: 1000000,
  }),
  uploadPackage: data => request.post('/menu/package/upload', data, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
    timeout: 1000000,
  }),
}
