Cart fixes (backend), adjusted header, added footer, mobile formatting updates
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
apiClearCart,
|
||||
apiApplyCoupon,
|
||||
apiCheckout,
|
||||
apiCancelCheckout,
|
||||
} from "@/lib/cartApi";
|
||||
|
||||
const CartContext = createContext(null);
|
||||
@@ -133,6 +134,15 @@ export function CartProvider({ children }) {
|
||||
[token, selectedStoreId]
|
||||
);
|
||||
|
||||
const cancelCheckout = useCallback(
|
||||
async () => {
|
||||
if (!token || !selectedStoreId) return;
|
||||
await apiCancelCheckout(token, selectedStoreId);
|
||||
await refreshCart();
|
||||
},
|
||||
[token, selectedStoreId, refreshCart]
|
||||
);
|
||||
|
||||
const itemCount = cart?.items?.reduce((sum, i) => sum + i.quantity, 0) ?? 0;
|
||||
|
||||
return (
|
||||
@@ -150,6 +160,7 @@ export function CartProvider({ children }) {
|
||||
clearCart,
|
||||
applyCoupon,
|
||||
checkout,
|
||||
cancelCheckout,
|
||||
refreshCart,
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user