chore: build
Backend - Build & Lint / build (push) Successful in 31m25s
Frontend Admin - EAS Build / build (push) Successful in 1h24m40s

This commit is contained in:
Xor290
2026-11-15 22:05:14 +01:00
parent 3ce40dd2be
commit beb78bf062
14 changed files with 1204 additions and 35 deletions
+11
View File
@@ -644,6 +644,17 @@ export const updateProductAdmin = async (
return { success: true, data: data.data, message: data.message };
};
export const updateProductStockAdmin = async (
productId: number,
stock: number,
) => {
const { data } = await apiClient.post(
`${V2}/admin/protected/products/${productId}/stock`,
{ stock },
);
return { success: true, product: data.product };
};
export const deleteProductAdmin = async (productId: number) => {
const { data } = await apiClient.delete(
`${V2}/admin/protected/products/${productId}`,
@@ -23,6 +23,7 @@ import {
getAllProductsAdmin,
createProductAdmin,
updateProductAdmin,
updateProductStockAdmin,
deleteProductAdmin,
uploadProductMediaAdmin,
deleteProductMediaAdmin,
@@ -334,16 +335,20 @@ export default function ProductsScreen() {
}
}
// 2) Update product fields
// 2) Update product fields (sans le stock : il n'écrase pas les ventes en cours)
await updateProductAdmin(editingProduct.id, {
name: form.name.trim(),
category: form.category,
description: form.description.trim(),
stock: parseFloat(form.stock),
unit: form.unit,
prices,
coming_soon: form.comingSoon,
});
const newStock = parseFloat(form.stock);
if (newStock !== editingProduct.stock) {
await updateProductStockAdmin(editingProduct.id, newStock);
}
productId = editingProduct.id;
} else {
// ✅ FIX : Création avec FormData au bon format pour le backend Go