|
|
|
|
@@ -1,69 +1,68 @@
|
|
|
|
|
import http from './http'
|
|
|
|
|
|
|
|
|
|
export const api = {
|
|
|
|
|
register: (payload) => http.post('/api/auth/register', payload),
|
|
|
|
|
login: (payload) => http.post('/api/auth/login', payload),
|
|
|
|
|
me: () => http.get('/api/auth/me'),
|
|
|
|
|
updateMe: (payload) => http.put('/api/auth/me', payload),
|
|
|
|
|
register: (payload) => http.post('/auth/register', payload),
|
|
|
|
|
login: (payload) => http.post('/auth/login', payload),
|
|
|
|
|
me: () => http.get('/auth/me'),
|
|
|
|
|
updateMe: (payload) => http.put('/auth/me', payload),
|
|
|
|
|
|
|
|
|
|
banners: () => http.get('/api/public/banners'),
|
|
|
|
|
products: (keyword = '') => http.get('/api/public/products', { params: { keyword } }),
|
|
|
|
|
banners: () => http.get('/public/banners'),
|
|
|
|
|
products: (keyword = '') => http.get('/public/products', { params: { keyword } }),
|
|
|
|
|
|
|
|
|
|
customerCart: () => http.get('/api/customer/cart'),
|
|
|
|
|
customerCartViews: () => http.get('/api/customer/cart/views'),
|
|
|
|
|
addCart: (payload) => http.post('/api/customer/cart', payload),
|
|
|
|
|
delCart: (productId) => http.delete(`/api/customer/cart/${productId}`),
|
|
|
|
|
checkout: (payload) => http.post('/api/customer/orders/checkout', payload),
|
|
|
|
|
customerBuyNow: (payload) => http.post('/api/customer/orders/buy-now', payload),
|
|
|
|
|
customerOrders: () => http.get('/api/customer/orders'),
|
|
|
|
|
refundOrder: (id, payload) => http.put(`/api/customer/orders/${id}/refund`, payload),
|
|
|
|
|
updateOrderAddress: (id, payload) => http.put(`/api/customer/orders/${id}/address`, payload),
|
|
|
|
|
deleteOrder: (id) => http.delete(`/api/customer/orders/${id}`),
|
|
|
|
|
orderLogistics: (id) => http.get(`/api/customer/orders/${id}/logistics`),
|
|
|
|
|
customerFavorites: () => http.get('/api/customer/favorites'),
|
|
|
|
|
customerFavoriteViews: () => http.get('/api/customer/favorites/views'),
|
|
|
|
|
addFavorite: (payload) => http.post('/api/customer/favorites', payload),
|
|
|
|
|
deleteFavorite: (productId) => http.delete(`/api/customer/favorites/${productId}`),
|
|
|
|
|
addReview: (payload) => http.post('/api/customer/reviews', payload),
|
|
|
|
|
orderItems: (orderId) => http.get(`/api/customer/orders/${orderId}/items`),
|
|
|
|
|
applyMerchant: (payload) => http.post('/api/customer/merchant-applications', payload),
|
|
|
|
|
customerCart: () => http.get('/customer/cart'),
|
|
|
|
|
customerCartViews: () => http.get('/customer/cart/views'),
|
|
|
|
|
addCart: (payload) => http.post('/customer/cart', payload),
|
|
|
|
|
delCart: (productId) => http.delete(`/customer/cart/${productId}`),
|
|
|
|
|
checkout: (payload) => http.post('/customer/orders/checkout', payload),
|
|
|
|
|
customerBuyNow: (payload) => http.post('/customer/orders/buy-now', payload),
|
|
|
|
|
customerOrders: () => http.get('/customer/orders'),
|
|
|
|
|
refundOrder: (id, payload) => http.put(`/customer/orders/${id}/refund`, payload),
|
|
|
|
|
updateOrderAddress: (id, payload) => http.put(`/customer/orders/${id}/address`, payload),
|
|
|
|
|
deleteOrder: (id) => http.delete(`/customer/orders/${id}`),
|
|
|
|
|
orderLogistics: (id) => http.get(`/customer/orders/${id}/logistics`),
|
|
|
|
|
customerFavorites: () => http.get('/customer/favorites'),
|
|
|
|
|
customerFavoriteViews: () => http.get('/customer/favorites/views'),
|
|
|
|
|
addFavorite: (payload) => http.post('/customer/favorites', payload),
|
|
|
|
|
deleteFavorite: (productId) => http.delete(`/customer/favorites/${productId}`),
|
|
|
|
|
addReview: (payload) => http.post('/customer/reviews', payload),
|
|
|
|
|
orderItems: (orderId) => http.get(`/customer/orders/${orderId}/items`),
|
|
|
|
|
applyMerchant: (payload) => http.post('/customer/merchant-applications', payload),
|
|
|
|
|
|
|
|
|
|
merchantOverview: () => http.get('/api/merchant/overview'),
|
|
|
|
|
merchantProducts: () => http.get('/api/merchant/products'),
|
|
|
|
|
saveMerchantProduct: (payload) => http.post('/api/merchant/products', payload),
|
|
|
|
|
deleteMerchantProduct: (id) => http.delete(`/api/merchant/products/${id}`),
|
|
|
|
|
merchantOrders: () => http.get('/api/merchant/orders'),
|
|
|
|
|
shipOrder: (id, payload) => http.put(`/api/merchant/orders/${id}/ship`, payload),
|
|
|
|
|
merchantRefund: (id, payload) => http.put(`/api/merchant/orders/${id}/refund`, payload),
|
|
|
|
|
merchantReviews: () => http.get('/api/merchant/reviews'),
|
|
|
|
|
merchantLogistics: () => http.get('/api/merchant/logistics'),
|
|
|
|
|
merchantInventory: () => http.get('/api/merchant/inventory'),
|
|
|
|
|
deleteMerchantInventory: (id) => http.delete(`/api/merchant/inventory/${id}`),
|
|
|
|
|
merchantOverview: () => http.get('/merchant/overview'),
|
|
|
|
|
merchantProducts: () => http.get('/merchant/products'),
|
|
|
|
|
saveMerchantProduct: (payload) => http.post('/merchant/products', payload),
|
|
|
|
|
deleteMerchantProduct: (id) => http.delete(`/merchant/products/${id}`),
|
|
|
|
|
merchantOrders: () => http.get('/merchant/orders'),
|
|
|
|
|
shipOrder: (id, payload) => http.put(`/merchant/orders/${id}/ship`, payload),
|
|
|
|
|
merchantRefund: (id, payload) => http.put(`/merchant/orders/${id}/refund`, payload),
|
|
|
|
|
merchantReviews: () => http.get('/merchant/reviews'),
|
|
|
|
|
merchantLogistics: () => http.get('/merchant/logistics'),
|
|
|
|
|
merchantInventory: () => http.get('/merchant/inventory'),
|
|
|
|
|
deleteMerchantInventory: (id) => http.delete(`/merchant/inventory/${id}`),
|
|
|
|
|
|
|
|
|
|
adminOverview: () => http.get('/api/admin/overview'),
|
|
|
|
|
adminUsers: () => http.get('/api/admin/users'),
|
|
|
|
|
adminSaveUser: (payload) => http.post('/api/admin/users', payload),
|
|
|
|
|
adminDeleteUser: (id) => http.delete(`/api/admin/users/${id}`),
|
|
|
|
|
adminOrders: () => http.get('/api/admin/orders'),
|
|
|
|
|
adminUpdateOrder: (id, payload) => http.put(`/api/admin/orders/${id}`, payload),
|
|
|
|
|
adminOrderRisks: () => http.get('/api/admin/orders/risk'),
|
|
|
|
|
adminAuditRefund: (id, payload) => http.put(`/api/admin/orders/${id}/refund-audit`, payload),
|
|
|
|
|
adminAuditShipment: (id, payload) => http.put(`/api/admin/orders/${id}/ship-audit`, payload),
|
|
|
|
|
adminMerchantApplications: () => http.get('/api/admin/merchant-applications'),
|
|
|
|
|
adminAuditMerchantApplication: (id, payload) => http.put(`/api/admin/merchant-applications/${id}`, payload),
|
|
|
|
|
adminBanners: () => http.get('/api/admin/banners'),
|
|
|
|
|
adminSaveBanner: (payload) => http.post('/api/admin/banners', payload),
|
|
|
|
|
adminDeleteBanner: (id) => http.delete(`/api/admin/banners/${id}`),
|
|
|
|
|
adminProducts: () => http.get('/api/admin/products'),
|
|
|
|
|
adminProductViews: () => http.get('/api/admin/products/views'),
|
|
|
|
|
adminSaveProduct: (payload) => http.post('/api/admin/products', payload),
|
|
|
|
|
adminApproveProduct: (id, payload) => http.put(`/api/admin/products/${id}/approve`, payload),
|
|
|
|
|
adminDeleteProduct: (id) => http.delete(`/api/admin/products/${id}`),
|
|
|
|
|
adminReviews: () => http.get('/api/admin/reviews'),
|
|
|
|
|
adminLogistics: () => http.get('/api/admin/logistics'),
|
|
|
|
|
adminInventory: () => http.get('/api/admin/inventory'),
|
|
|
|
|
adminOverview: () => http.get('/admin/overview'),
|
|
|
|
|
adminUsers: () => http.get('/admin/users'),
|
|
|
|
|
adminSaveUser: (payload) => http.post('/admin/users', payload),
|
|
|
|
|
adminDeleteUser: (id) => http.delete(`/admin/users/${id}`),
|
|
|
|
|
adminOrders: () => http.get('/admin/orders'),
|
|
|
|
|
adminUpdateOrder: (id, payload) => http.put(`/admin/orders/${id}`, payload),
|
|
|
|
|
adminOrderRisks: () => http.get('/admin/orders/risk'),
|
|
|
|
|
adminAuditRefund: (id, payload) => http.put(`/admin/orders/${id}/refund-audit`, payload),
|
|
|
|
|
adminAuditShipment: (id, payload) => http.put(`/admin/orders/${id}/ship-audit`, payload),
|
|
|
|
|
adminMerchantApplications: () => http.get('/admin/merchant-applications'),
|
|
|
|
|
adminAuditMerchantApplication: (id, payload) => http.put(`/admin/merchant-applications/${id}`, payload),
|
|
|
|
|
adminBanners: () => http.get('/admin/banners'),
|
|
|
|
|
adminSaveBanner: (payload) => http.post('/admin/banners', payload),
|
|
|
|
|
adminDeleteBanner: (id) => http.delete(`/admin/banners/${id}`),
|
|
|
|
|
adminProducts: () => http.get('/admin/products'),
|
|
|
|
|
adminProductViews: () => http.get('/admin/products/views'),
|
|
|
|
|
adminSaveProduct: (payload) => http.post('/admin/products', payload),
|
|
|
|
|
adminApproveProduct: (id, payload) => http.put(`/admin/products/${id}/approve`, payload),
|
|
|
|
|
adminDeleteProduct: (id) => http.delete(`/admin/products/${id}`),
|
|
|
|
|
adminReviews: () => http.get('/admin/reviews'),
|
|
|
|
|
adminLogistics: () => http.get('/admin/logistics'),
|
|
|
|
|
adminInventory: () => http.get('/admin/inventory'),
|
|
|
|
|
|
|
|
|
|
// File Upload
|
|
|
|
|
uploadImage: (file) => {
|
|
|
|
|
const formData = new FormData()
|
|
|
|
|
formData.append('file', file)
|
|
|
|
|
@@ -74,7 +73,7 @@ export const api = {
|
|
|
|
|
uploadFile: (file) => {
|
|
|
|
|
const formData = new FormData()
|
|
|
|
|
formData.append('file', file)
|
|
|
|
|
return http.post('/api/upload', formData, {
|
|
|
|
|
return http.post('/upload', formData, {
|
|
|
|
|
headers: { 'Content-Type': 'multipart/form-data' }
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|