Spaces:
Running
Running
| import api from './axios'; | |
| export const getProducts = (params = {}) => | |
| api.get('/api/products/', { params }); | |
| export const getProduct = (id) => | |
| api.get(`/api/products/${id}`); | |
| export const createProduct = (data) => | |
| api.post('/api/products/', data); | |
| export const updateProduct = (id, data) => | |
| api.put(`/api/products/${id}`, data); | |
| export const deleteProduct = (id) => | |
| api.delete(`/api/products/${id}`); | |
| export const uploadProductImage = (file) => { | |
| const form = new FormData(); | |
| form.append('file', file); | |
| return api.post('/api/products/upload-image', form, { | |
| headers: { 'Content-Type': 'multipart/form-data' }, | |
| }); | |
| }; | |