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