From 89345a3d1d7201272bff1b4e4a8ffb4fcf5b3e9e Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 22 Aug 2024 10:15:35 +0700
Subject: <iman> add ? to data fetch

---
 .../modules/promo/components/HeroDiskon.tsx        | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

(limited to 'src-migrate/modules/promo/components/HeroDiskon.tsx')

diff --git a/src-migrate/modules/promo/components/HeroDiskon.tsx b/src-migrate/modules/promo/components/HeroDiskon.tsx
index 6d38c763..8b8edcc0 100644
--- a/src-migrate/modules/promo/components/HeroDiskon.tsx
+++ b/src-migrate/modules/promo/components/HeroDiskon.tsx
@@ -39,7 +39,7 @@ const Hero = () => {
     queryFn: () => getBanner({ type: 'banner-promotion' })
   })
 
-  const banners = useMemo(() => bannerQuery.data || [], [bannerQuery.data]);
+  const banners = useMemo(() => bannerQuery?.data || [], [bannerQuery?.data]);
 
   useEffect(() => {
     if (banners.length > 1) {
@@ -56,8 +56,8 @@ const Hero = () => {
             {banners.map((banner, index) => (
                 <SwiperSlide key={index}>
                 <Image
-                    src={banner.image}
-                    alt={banner.name}
+                    src={banner?.image}
+                    alt={banner?.name}
                     width={666}
                     height={480}
                     className='w-[446px]  h-[446px] object-fill object-center rounded-2xl'
@@ -71,8 +71,8 @@ const Hero = () => {
           {banners.map((banner, index) => (
             <SwiperSlide key={index}>
               <Image
-                src={banner.image}
-                alt={banner.name}
+                src={banner?.image}
+                alt={banner?.name}
                 width={666}
                 height={450}
                 className='w-[400px] h-[217px] object-cover object-center rounded-2xl '
@@ -86,8 +86,8 @@ const Hero = () => {
           {banners.map((banner, index) => (
             <SwiperSlide key={index}>
               <Image
-                src={banner.image}
-                alt={banner.name}
+                src={banner?.image}
+                alt={banner?.name}
                 width={666}
                 height={450}
                 className='w-[400px] h-[217px] object-cover object-center rounded-2xl'
@@ -101,8 +101,8 @@ const Hero = () => {
           {banners.map((banner, index) => (
             <SwiperSlide key={index}>
               <Image
-                src={banner.image}
-                alt={banner.name}
+                src={banner?.image}
+                alt={banner?.name}
                 width={666}
                 height={450}
                 className='w-[400px] h-[217px] object-cover object-center rounded-2xl'
@@ -116,8 +116,8 @@ const Hero = () => {
           {banners.map((banner, index) => (
             <SwiperSlide key={index}>
               <Image
-                src={banner.image}
-                alt={banner.name}
+                src={banner?.image}
+                alt={banner?.name}
                 width={666}
                 height={450}
                 className='w-[400px] h-[217px] object-cover object-center rounded-2xl'
-- 
cgit v1.2.3

