bug fix
This commit is contained in:
@@ -63,7 +63,7 @@ const ProductDetail = () => {
|
||||
if (!data || !cartItems) return;
|
||||
|
||||
const item = cartItems?.data.cart_item.find(
|
||||
(item) => Number(item.product_id) === data?.id,
|
||||
(item) => Number(item.product.id) === data?.id,
|
||||
);
|
||||
|
||||
if (item) {
|
||||
@@ -78,7 +78,7 @@ const ProductDetail = () => {
|
||||
if (quantity <= 0) return;
|
||||
|
||||
const cartItem = cartItems?.data?.cart_item.find(
|
||||
(item) => Number(item.product_id) === data?.id,
|
||||
(item) => Number(item.product.id) === data?.id,
|
||||
);
|
||||
|
||||
if (!cartItem) return;
|
||||
@@ -87,7 +87,10 @@ const ProductDetail = () => {
|
||||
if (debounceRef.current) clearTimeout(debounceRef.current);
|
||||
|
||||
debounceRef.current = setTimeout(() => {
|
||||
updateCartItem({ body: { quantity }, cart_item_id: cartItem.id });
|
||||
updateCartItem({
|
||||
body: { quantity },
|
||||
cart_item_id: cartItem.id.toString(),
|
||||
});
|
||||
}, 500);
|
||||
|
||||
return () => {
|
||||
@@ -150,13 +153,13 @@ const ProductDetail = () => {
|
||||
if (!data || !cart_id) return;
|
||||
|
||||
const cartItem = cartItems?.data.cart_item.find(
|
||||
(e) => Number(e.product_id) === data.id,
|
||||
(e) => Number(e.product.id) === data.id,
|
||||
);
|
||||
|
||||
if (cartItem) {
|
||||
updateCartItem({
|
||||
body: { quantity: quantity },
|
||||
cart_item_id: cartItem.id,
|
||||
cart_item_id: cartItem.id.toString(),
|
||||
});
|
||||
} else {
|
||||
mutate({
|
||||
@@ -435,7 +438,7 @@ const ProductDetail = () => {
|
||||
{recomendation &&
|
||||
!proLoad &&
|
||||
recomendation
|
||||
.filter((product) => product.is_active)
|
||||
.filter((product) => product.state === 'A')
|
||||
.map((product) => (
|
||||
<CarouselItem
|
||||
key={product.id}
|
||||
|
||||
Reference in New Issue
Block a user