chore: fix

This commit is contained in:
2026-05-03 19:44:35 +02:00
parent f8473b9a54
commit 37ae4117b4
5 changed files with 37 additions and 20 deletions
+8 -7
View File
@@ -113,21 +113,22 @@ export function CartProvider({ children }: { children: ReactNode }) {
} else {
// ✅ Transformer les items - quantity = grammes
const items: CartItem[] = panierData.map((item) => {
const category = (item.category || "autre")
const category = String(item.category || "autre")
.toLowerCase()
.trim();
return {
id: item.id,
product_id: item.product_id,
name_product:
id: item.id as number,
product_id: item.product_id as number,
name_product: String(
item.product_name ||
item.name_product ||
"Produit",
price: item.price,
quantity: item.quantity, // ✨ En grammes (5, 10, 25, etc.)
),
price: item.price as number,
quantity: item.quantity as number,
category: category,
image: item.image, // Image sera gérée par Cart.tsx avec getProductById
image: item.image as string | undefined,
};
});