diff options
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> |
