diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-03-31 11:11:45 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-03-31 11:11:45 +0700 |
| commit | 6532172b4cc62bfcb56cc1e12ba805fc4c950f5a (patch) | |
| tree | c0d185e4091bbad3286bb0e5874c638265d58a83 /src/lib/cart/components/Cart.jsx | |
| parent | 3ce85149313383bfc064237748e5a80d6e16180d (diff) | |
| parent | f23d32a4b8402904e8daa7b906c03a64104ed253 (diff) | |
Merge branch 'master' of https://bitbucket.org/altafixco/next-indoteknik
Diffstat (limited to 'src/lib/cart/components/Cart.jsx')
| -rw-r--r-- | src/lib/cart/components/Cart.jsx | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index 8d995103..8400857d 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -14,7 +14,6 @@ import Spinner from '@/core/components/elements/Spinner/Spinner' import Alert from '@/core/components/elements/Alert/Alert' import MobileView from '@/core/components/views/MobileView' import DesktopView from '@/core/components/views/DesktopView' -import variantPriceApi from '@/lib/variant/api/variantPriceApi' const Cart = () => { const router = useRouter() @@ -29,24 +28,16 @@ const Cart = () => { useEffect(() => { if (cart.data && !products) { - const productsWithQuantity = cart.data.map(async (product) => { + const productsWithQuantity = cart.data.map((product) => { const productInCart = getItemCart({ productId: product.id }) if (!productInCart) return - const productPrice = await variantPriceApi({ id: product.id }) return { ...product, - price: { - price: productPrice.priceExclude, - discountPercentage: productPrice.discount, - priceDiscount: productPrice.priceExcludeAfterDiscount - }, quantity: productInCart.quantity, selected: productInCart.selected } }) - Promise.all(productsWithQuantity).then((resolvedProducts) => { - setProducts(resolvedProducts) - }) + setProducts(productsWithQuantity) } }, [cart, products]) |
