fix: change backend hadlers, API route and uploads photo
This commit is contained in:
@@ -42,11 +42,19 @@ export const getAllCategories = () => axios.get(`${API_URL}/getCategories`);
|
||||
export const getCart = () => axios.get(`${API_URL}/cart/`);
|
||||
export const addToCart = (data) => axios.post(`${API_URL}/cart/`, data);
|
||||
export const updateCartItem = (id, data) =>
|
||||
axios.post(`${API_URL}/cart/${id}`, data);
|
||||
axios.patch(`${API_URL}/cart/${id}`, data);
|
||||
export const removeFromCart = (id) => axios.delete(`${API_URL}/cart/${id}`);
|
||||
export const createOrder = (data) => axios.post(`${API_URL}/orders/`, data);
|
||||
export const getUserOrders = () => axios.get(`${API_URL}/orders`);
|
||||
export const getOrder = (id) => axios.get(`${API_URL}/orders/${id}`);
|
||||
|
||||
export const updateProfile = () => axios.patch(`${API_URL}/profile`);
|
||||
export const updateProfile = (data) => axios.patch(`${API_URL}/profile`);
|
||||
export const getUserInfo = () => axios.get(`${API_URL}/profile`);
|
||||
|
||||
export const uploadItemAvatar = (id, file) => {
|
||||
const formData = new FormData();
|
||||
formData.append("avatar", file);
|
||||
return axios.patch(`${API_URL}/admin/items/${id}/avatar`, formData, {
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user