This commit is contained in:
Samandar Turgunboyev
2026-01-24 16:29:27 +05:00
parent 59045c583d
commit 1f77cc360d

View File

@@ -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}