From 085dcb058ef4b92cea8b4044e65dd940580f3f42 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 7 Aug 2024 15:26:32 +0700
Subject: <iman> merge all promotion

---
 src/core/components/elements/Navbar/TopBanner.jsx | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'src/core/components/elements/Navbar/TopBanner.jsx')

diff --git a/src/core/components/elements/Navbar/TopBanner.jsx b/src/core/components/elements/Navbar/TopBanner.jsx
index df47e87d..265dfb5e 100644
--- a/src/core/components/elements/Navbar/TopBanner.jsx
+++ b/src/core/components/elements/Navbar/TopBanner.jsx
@@ -3,9 +3,10 @@ import { useQuery } from 'react-query';import useDevice from '@/core/hooks/useDe
 import odooApi from '@/core/api/odooApi';
 import SmoothRender from '~/components/ui/smooth-render';
 import Link from '../Link/Link';
+import { useEffect } from 'react';
 import { background } from '@chakra-ui/react';
 
-const TopBanner = () => {
+const TopBanner = ({ onLoad }) => {
   const { isDesktop, isMobile } = useDevice()
   const topBanner = useQuery({
     queryKey: 'topBanner',
@@ -17,6 +18,12 @@ const TopBanner = () => {
   const hasData = topBanner.data?.length > 0;
   const data = topBanner.data?.[0] || null;
 
+  useEffect(() => {
+    if (hasData) {
+      onLoad();
+    }
+  }, [hasData, onLoad]);
+
   return (
     <SmoothRender
       isLoaded={hasData}
-- 
cgit v1.2.3

