chore: fix
This commit is contained in:
@@ -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,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user