diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-08-02 10:16:46 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2024-08-02 10:16:46 +0000 |
| commit | d8510399c21b2cf4bf606441397a0142bc265a94 (patch) | |
| tree | 75543baf82a73fb7e8dea6c8a1c353e02c57bbcd /src-migrate/modules/product-detail/components/AddToCart.tsx | |
| parent | 6a2c25e83a45eeb5d613a99a0caa6f0ec1aae15f (diff) | |
| parent | 55c9f5e1fb868c85e704529ac914b3d75fc7744e (diff) | |
Merged in Feature/new-cart-popup (pull request #208)
Feature/new cart popup
Diffstat (limited to 'src-migrate/modules/product-detail/components/AddToCart.tsx')
| -rw-r--r-- | src-migrate/modules/product-detail/components/AddToCart.tsx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src-migrate/modules/product-detail/components/AddToCart.tsx b/src-migrate/modules/product-detail/components/AddToCart.tsx index 0ac8229e..6c9aedf8 100644 --- a/src-migrate/modules/product-detail/components/AddToCart.tsx +++ b/src-migrate/modules/product-detail/components/AddToCart.tsx @@ -31,16 +31,17 @@ const AddToCart = ({ position: 'top', isClosable: true }) + const [product, setProducts] = useState(products); + const { productCart, setRefreshCart, setProductCart, refreshCart, isLoading, setIsloading } = - useProductCartContext() + useProductCartContext() const productSimilarQuery = [ product?.name, `fq=-product_id_i:${product.id}`, `fq=-manufacture_id_i:${product.manufacture?.id || 0}`, ].join('&'); - const [addCartAlert, setAddCartAlert] = useState(false); const handleClick = async () => { @@ -55,8 +56,10 @@ const AddToCart = ({ isNaN(quantity) || typeof auth !== 'object' ) return; + setRefreshCart(true); setAddCartAlert(true); + toast.promise( upsertUserCart({ userId: auth.id, @@ -103,8 +106,7 @@ const AddToCart = ({ active={addCartAlert} close={() => { setAddCartAlert(false); - } - } + }} > <div className='flex mt-4'> <div className='w-[10%]'> @@ -128,7 +130,6 @@ const AddToCart = ({ </Link> </div> </div> - <div className='mt-8 mb-4'> <div className='text-h-sm font-semibold mb-6'> Kamu Mungkin Juga Suka |
