From 44d0de6d483a762f7967f4fadf71b210aaab3ba5 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Thu, 30 Mar 2023 12:17:23 +0700
Subject: fix price checkout

---
 src/lib/checkout/components/Checkout.jsx | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

(limited to 'src/lib/checkout/components/Checkout.jsx')

diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index ffb33eb7..ac751ff4 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -19,7 +19,6 @@ import axios from 'axios'
 import Image from '@/core/components/elements/Image/Image'
 import MobileView from '@/core/components/views/MobileView'
 import DesktopView from '@/core/components/views/DesktopView'
-import variantPriceApi from '@/lib/variant/api/variantPriceApi'
 
 const Checkout = () => {
   const router = useRouter()
@@ -59,7 +58,6 @@ const Checkout = () => {
     })
   }, [addresses])
 
-  const [paymentMethod, setPaymentMethod] = useState('')
   const [products, setProducts] = useState(null)
   const [totalAmount, setTotalAmount] = useState(0)
   const [totalDiscountAmount, setTotalDiscountAmount] = useState(0)
@@ -78,25 +76,15 @@ const Checkout = () => {
       }
 
       const dataProducts = await CartApi({ variantIds })
-      const productsWithQuantity = dataProducts?.map(async (product) => {
-        const productPrice = await variantPriceApi({ id: product.id })
+      const productsWithQuantity = dataProducts?.map((product) => {
         return {
           ...product,
-          price: {
-            price: productPrice.priceExclude,
-            discountPercentage: productPrice.discount,
-            priceDiscount: productPrice.priceExcludeAfterDiscount
-          },
           quantity: query.quantity
             ? query.quantity
             : getItemCart({ productId: product.id }).quantity
         }
       })
-      if (productsWithQuantity) {
-        Promise.all(productsWithQuantity).then((resolvedProducts) => {
-          setProducts(resolvedProducts)
-        })
-      }
+      setProducts(productsWithQuantity)
     }
     loadProducts()
   }, [router])
-- 
cgit v1.2.3

