diff --git a/app/(admin)/admin/advertise/page.tsx b/app/(admin)/admin/advertise/page.tsx index c9fe8c3..20b6eab 100644 --- a/app/(admin)/admin/advertise/page.tsx +++ b/app/(admin)/admin/advertise/page.tsx @@ -104,7 +104,6 @@ export default function AdvertisePage() { } close(); - setRefresh(!refresh); MySwal.fire({ title: "Sukses", icon: "success", @@ -112,6 +111,7 @@ export default function AdvertisePage() { confirmButtonText: "OK", }).then((result) => { if (result.isConfirmed) { + setRefresh(!refresh); } }); }; diff --git a/components/landing/banner-new.tsx b/components/landing/banner-new.tsx index 9602837..7e536f3 100644 --- a/components/landing/banner-new.tsx +++ b/components/landing/banner-new.tsx @@ -53,6 +53,7 @@ interface Jumbotron { title: string; description: string; redirectLink: string; + contentFileUrl: string; } export default function BannerHumasNew() { @@ -92,7 +93,7 @@ export default function BannerHumasNew() { }, []); const initFetch = async () => { - const req = { page: 1, limit: 5, placement: "jumbotron" }; + const req = { page: 1, limit: 5, placement: "jumbotron", isPublish: true }; const res = await getAdvertise(req); setJumbotronList(res?.data?.data); }; @@ -224,21 +225,39 @@ export default function BannerHumasNew() { className="flex w-full h-[45vh] lg:h-[93vh] transition-transform duration-700 ease-in-out" style={{ transform: `translateX(-${currentIndex * 100}%)` }} > - {jumbotronList?.map((img, index) => ( - + {jumbotronList?.length > 0 ? ( + jumbotronList?.map((img, index) => ( + + {`humasbanner-${index}`} + + )) + ) : ( + {`humasbanner-${index}`} - ))} + )}