diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-07 11:49:54 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-07 11:49:54 +0700 |
| commit | 6bfa8b7b0c6afaec7eb3d81983d0f012953b07f2 (patch) | |
| tree | 7e54f5f0c6d7c54b040213eb46266f075af36657 /src/core/components/elements/Navbar/TopBanner.jsx | |
| parent | c26e511923265385bf5c3060de23c7e61912992c (diff) | |
<iman> add pop up semua promo
Diffstat (limited to 'src/core/components/elements/Navbar/TopBanner.jsx')
| -rw-r--r-- | src/core/components/elements/Navbar/TopBanner.jsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/components/elements/Navbar/TopBanner.jsx b/src/core/components/elements/Navbar/TopBanner.jsx index 722a7501..7bc8fb6a 100644 --- a/src/core/components/elements/Navbar/TopBanner.jsx +++ b/src/core/components/elements/Navbar/TopBanner.jsx @@ -4,8 +4,9 @@ import { useQuery } from 'react-query'; import odooApi from '@/core/api/odooApi'; import SmoothRender from '~/components/ui/smooth-render'; import Link from '../Link/Link'; +import { useEffect } from 'react'; -const TopBanner = () => { +const TopBanner = ({ onLoad }) => { const topBanner = useQuery({ queryKey: 'topBanner', queryFn: async () => await odooApi('GET', '/api/v1/banner?type=top-banner'), @@ -16,6 +17,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} |
