fixed produc tloading
This commit is contained in:
parent
d53957ca6d
commit
c40852703d
1 changed files with 1 additions and 1 deletions
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue