fixing banner landing

This commit is contained in:
Sabda Yagra 2025-07-23 17:34:08 +07:00
parent 2c18d422d5
commit 0873cef3ce
2 changed files with 57 additions and 9 deletions

View File

@ -218,8 +218,23 @@ const HeroModal = ({
};
}, []);
// const initFetch = async () => {
// const response = await listPopUp(
// group === "mabes"
// ? ""
// : group === "polda" && poldaName
// ? poldaName
// : group === "satker" && satkerName
// ? "satker-" + satkerName
// : "",
// locale == "en"
// );
// const interstitial = response?.data?.data || [];
// setHeroData(interstitial);
// };
const initFetch = async () => {
const response = await listPopUp(
const response = await listStaticBanner(
group === "mabes"
? ""
: group === "polda" && poldaName
@ -227,10 +242,17 @@ const HeroModal = ({
: group === "satker" && satkerName
? "satker-" + satkerName
: "",
locale == "en"
locale === "en"
);
const interstitial = response?.data?.data || [];
setHeroData(interstitial);
const banners = response?.data?.data || [];
const enrichedData = banners.map((item: any) => ({
...item,
fileTypeId: item?.fileType?.id ?? null,
}));
setHeroData(enrichedData);
};
const handleClickOutside = (event: React.MouseEvent<HTMLDivElement>) => {

View File

@ -2,7 +2,11 @@ import { formatDateToIndonesian, shimmer, toBase64 } from "@/utils/globals";
import React, { useEffect, useRef, useState } from "react";
import "swiper/css/bundle";
import "swiper/css/navigation";
import { getHeroData, listPopUp, listStaticBanner } from "@/service/landing/landing";
import {
getHeroData,
listPopUp,
listStaticBanner,
} from "@/service/landing/landing";
import Link from "next/link";
import { useParams, usePathname, useRouter } from "next/navigation";
import {
@ -207,8 +211,23 @@ const HeroModal = ({
};
}, []);
// const initFetch = async () => {
// const response = await listPopUp(
// group === "mabes"
// ? ""
// : group === "polda" && poldaName
// ? poldaName
// : group === "satker" && satkerName
// ? "satker-" + satkerName
// : "",
// locale == "en"
// );
// const interstitial = response?.data?.data || [];
// setHeroData(interstitial);
// };
const initFetch = async () => {
const response = await listPopUp(
const response = await listStaticBanner(
group === "mabes"
? ""
: group === "polda" && poldaName
@ -216,10 +235,17 @@ const HeroModal = ({
: group === "satker" && satkerName
? "satker-" + satkerName
: "",
locale == "en"
locale === "en"
);
const interstitial = response?.data?.data || [];
setHeroData(interstitial);
const banners = response?.data?.data || [];
const enrichedData = banners.map((item: any) => ({
...item,
fileTypeId: item?.fileType?.id ?? null,
}));
setHeroData(enrichedData);
};
const handleClickOutside = (event: React.MouseEvent<HTMLDivElement>) => {