diff options
| author | Rafi Zadanly <rafizadanly@gmail.com> | 2022-12-29 11:34:04 +0700 |
|---|---|---|
| committer | Rafi Zadanly <rafizadanly@gmail.com> | 2022-12-29 11:34:04 +0700 |
| commit | ec9e0f90c3d8111d77cc4bfc3c5f56f473428786 (patch) | |
| tree | 4e3a77083c6cf0701c4355d7291dfb7afe00e1cb /src/pages/shop/cart.js | |
| parent | ec3d2d806cc7e5dceb2be1d73b9351526ad75768 (diff) | |
no message
Diffstat (limited to 'src/pages/shop/cart.js')
| -rw-r--r-- | src/pages/shop/cart.js | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/pages/shop/cart.js b/src/pages/shop/cart.js index 9fd44410..6fe079b3 100644 --- a/src/pages/shop/cart.js +++ b/src/pages/shop/cart.js @@ -4,6 +4,7 @@ import { TrashIcon, PlusIcon, MinusIcon, + ExclamationCircleIcon, } from "@heroicons/react/24/solid"; import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; import { useRouter } from "next/router"; @@ -41,23 +42,23 @@ export default function Cart() { show: false }); - const getProducts = async () => { - let cart = getCart(); - let productIds = Object.keys(cart); - if (productIds.length > 0) { - productIds = productIds.join(','); - let dataProducts = await apiOdoo('GET', `/api/v1/product_variant/${productIds}`); - dataProducts = dataProducts.map((product) => ({ - ...product, - quantity: cart[product.id].quantity, - to_process: cart[product.id].to_process, - })); - setProducts(dataProducts); - } - setIsLoadingProducts(false); - } - + useEffect(() => { + const getProducts = async () => { + let cart = getCart(); + let productIds = Object.keys(cart); + if (productIds.length > 0) { + productIds = productIds.join(','); + let dataProducts = await apiOdoo('GET', `/api/v1/product_variant/${productIds}`); + dataProducts = dataProducts.map((product) => ({ + ...product, + quantity: cart[product.id].quantity, + to_process: cart[product.id].to_process, + })); + setProducts(dataProducts); + } + setIsLoadingProducts(false); + } getProducts(); }, []); @@ -188,7 +189,7 @@ export default function Cart() { {/* --- Start Alert */} <Alert type="warning" className="text-caption-2 flex gap-x-3 items-center my-2"> <div> - <ExclamationTriangleIcon className="w-8"/> + <ExclamationCircleIcon className="w-8 text-yellow_r-11"/> </div> <span>Mohon dicek kembali & pastikan pesanan kamu sudah sesuai dengan yang kamu butuhkan. Atau bisa hubungi kami.</span> </Alert> |
