import { request } from '@/utils'

export default {
  create: data => request.post('/menu', data),
  read: (params = {}) => request.get('/menu/page', { params }),
  update: data => request.patch(`/menu/${data.id}`, data),
  delete: id => request.delete(`/menu/${id}`),
  getOne: id => request.get(`/menu/detail/${id}`),
  getLevel: id => request.get(`/menu/level/${id}`),
  uploadImage: data => request.post('/menu/cover/upload', data, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  }),
}
