fixed produc tloading

This commit is contained in:
2ManyProjects 2025-04-26 13:22:29 -05:00
parent d53957ca6d
commit c40852703d

View file

@ -42,7 +42,7 @@ const ProductDetailPage = () => {
// Fetch product data // Fetch product data
const { data: products, isLoading, error } = useProduct(id); const { data: products, isLoading, error } = useProduct(id);
const addToCart = useAddToCart(); const addToCart = useAddToCart();
let product = products[0] let product = products?.length > 0 ? products[0] : null
// Handle quantity changes // Handle quantity changes
const increaseQuantity = () => { const increaseQuantity = () => {
if (product && quantity < product.stock_quantity) { if (product && quantity < product.stock_quantity) {