From b261f7fd592965fe60fbfb8842d9769b96988573 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 13 Mar 2025 13:29:17 +0700
Subject: <iman> CR renca benner

---
 src-migrate/modules/side-banner/index.tsx | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'src-migrate/modules/side-banner/index.tsx')

diff --git a/src-migrate/modules/side-banner/index.tsx b/src-migrate/modules/side-banner/index.tsx
index 878b8e70..23ffc112 100644
--- a/src-migrate/modules/side-banner/index.tsx
+++ b/src-migrate/modules/side-banner/index.tsx
@@ -5,12 +5,16 @@ import Image from "~/components/ui/image";;
 import { getBanner } from "~/services/banner";
 import { getRandomInt } from '@/utils/getRandomInt';
 
-const SideBanner = () => {
+interface SideBannerProps {
+  query?: string; // Menentukan bahwa 'query' adalah string (bisa undefined)
+}
+
+const SideBanner: React.FC<SideBannerProps> = ({ query }) => {
   const fetchSideBanner = useQuery({
-    queryKey: 'sideBanner',
-    queryFn: () => getBanner({ type: 'side-banner-search' })
+    queryKey: ["sideBanner", query],
+    queryFn: () => getBanner({ type: "side-banner-search", keyword: query }),
   });
-
+  console.log("fetchSideBanner",fetchSideBanner)
   const length = useMemo(() => fetchSideBanner.data?.length, [fetchSideBanner.data]);
   const randomIndex = useMemo(() => getRandomInt(length), [length]);
   const banner = fetchSideBanner?.data?.[randomIndex] || false;
-- 
cgit v1.2.3

