chore: update

This commit is contained in:
2026-03-19 19:56:51 +01:00
parent 3384ebded0
commit 7173266bb9
31 changed files with 3645 additions and 1942 deletions
+3 -10
View File
@@ -7,7 +7,6 @@
import {
createContext,
useContext,
useState,
useEffect,
type ReactNode,
@@ -55,7 +54,7 @@ interface ToastMessage {
type: "success" | "error" | "warning" | "info";
}
const CartContext = createContext<CartContextType | undefined>(undefined);
export const CartContext = createContext<CartContextType | undefined>(undefined);
export function CartProvider({ children }: { children: ReactNode }) {
const [cartItems, setCartItems] = useState<CartItem[]>([]);
@@ -201,9 +200,10 @@ export function CartProvider({ children }: { children: ReactNode }) {
const requestData = {
username,
product_id: item.product_id || 0,
name_product: cleanName,
category: category,
quantity: Number(item.quantity), // ✨ Grammes (5, 10, 25)
quantity: Number(item.quantity),
price: Number(item.price) || 0,
};
@@ -345,10 +345,3 @@ export function CartProvider({ children }: { children: ReactNode }) {
);
}
export function useCart() {
const context = useContext(CartContext);
if (!context) {
throw new Error("useCart must be used within a CartProvider");
}
return context;
}
+10
View File
@@ -0,0 +1,10 @@
import { useContext } from "react";
import { CartContext } from "./CartContext";
export function useCart() {
const context = useContext(CartContext);
if (!context) {
throw new Error("useCart must be used within a CartProvider");
}
return context;
}