summaryrefslogtreecommitdiff
path: root/src-migrate/modules/product-detail/components
diff options
context:
space:
mode:
Diffstat (limited to 'src-migrate/modules/product-detail/components')
-rw-r--r--src-migrate/modules/product-detail/components/AddToCart.tsx11
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