From 0f4938c0f9ce12d60bac2eb012a98b818fcd5110 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 6 Aug 2024 08:59:31 +0700
Subject: <iman> update refresh cart

---
 src-migrate/modules/product-detail/components/AddToCart.tsx | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'src-migrate/modules/product-detail/components/AddToCart.tsx')

diff --git a/src-migrate/modules/product-detail/components/AddToCart.tsx b/src-migrate/modules/product-detail/components/AddToCart.tsx
index 6c9aedf8..c73d7b36 100644
--- a/src-migrate/modules/product-detail/components/AddToCart.tsx
+++ b/src-migrate/modules/product-detail/components/AddToCart.tsx
@@ -34,8 +34,7 @@ const AddToCart = ({
 
   const [product, setProducts] = useState(products);
   
-  const { productCart, setRefreshCart, setProductCart, refreshCart, isLoading, setIsloading } =
-  useProductCartContext()
+  const {setRefreshCart} = useProductCartContext()
 
   const productSimilarQuery = [
     product?.name,
@@ -50,16 +49,17 @@ const AddToCart = ({
       router.push(`/login?next=${currentUrl}`)
       return;
     }
-
+    
     if (
       !variantId ||
       isNaN(quantity) ||
       typeof auth !== 'object'
     ) return;
-
+    
     setRefreshCart(true);
+    // console.log('Refresh cart triggered');
     setAddCartAlert(true);
-
+    
     toast.promise(
       upsertUserCart({
         userId: auth.id,
@@ -78,7 +78,7 @@ const AddToCart = ({
     )
     
     
-
+    
     if (source === 'buy') {
       router.push('/shop/checkout?source=buy')
     }
-- 
cgit v1.2.3

