diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-06 08:59:31 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-06 08:59:31 +0700 |
| commit | 0f4938c0f9ce12d60bac2eb012a98b818fcd5110 (patch) | |
| tree | 714cf402e454e252b03b7929dc84ba4758cfa291 /src-migrate/modules | |
| parent | 7eb2d613c6b16c89dd06491a54b229bcbcb8dc13 (diff) | |
<iman> update refresh cart
Diffstat (limited to 'src-migrate/modules')
| -rw-r--r-- | src-migrate/modules/product-detail/components/AddToCart.tsx | 12 |
1 files changed, 6 insertions, 6 deletions
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') } |
