summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-08-04 13:36:47 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-08-04 13:36:47 +0700
commit9595223471946520f5c156e24eceb577fae4c901 (patch)
treec277d619ddc0f8fd790bcad35ba1115c37859923
parentd9652e77733a24b329f8d849e700222f06c4331e (diff)
add backgorund image mobile
-rw-r--r--src/lib/product/components/Product/ProductMobile.jsx10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx
index f0264542..d25d0861 100644
--- a/src/lib/product/components/Product/ProductMobile.jsx
+++ b/src/lib/product/components/Product/ProductMobile.jsx
@@ -45,7 +45,9 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
useEffect(() => {
const getBackgound = async () => {
const get = await odooApi('GET', '/api/v1/banner?type=flash-sale-background-banner')
- setBackgorundFlashSale(get[0].image)
+ if (get.length > 0) {
+ setBackgorundFlashSale(get[0].image)
+ }
}
getBackgound()
}, [])
@@ -171,7 +173,11 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
{product?.flashSale?.remainingTime > 0 && (
<div className={`absolute bottom-0 w-full`}>
<div className='absolute bottom-0 w-full'>
- <ImageNext src={backgorundFlashSale || '/images/GAMBAR-BG-FLASH-SALE.jpg'} width={1000} height={100} />
+ <ImageNext
+ src={backgorundFlashSale || '/images/GAMBAR-BG-FLASH-SALE.jpg'}
+ width={1000}
+ height={100}
+ />
</div>
<div className='relative'>
<div className='flex gap-x-2 items-center p-2'>