fix: change backend hadlers, API route and uploads photo

This commit is contained in:
2026-06-24 20:47:14 +03:00
parent 2c22cee60b
commit 115f52a8f1
5 changed files with 189 additions and 10 deletions
+10 -2
View File
@@ -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" },
});
};