diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-31 09:25:53 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-31 09:25:53 +0700 |
| commit | 6a0c477de3df773f2a818b904029624c212f083f (patch) | |
| tree | e1f7a09eb83509de594fe7dbb015a71dd18cec26 /src/core/components/elements/Navbar/TopBanner.jsx | |
| parent | 3de1a412bba31b19b8b443dd91df8aff8d6eda07 (diff) | |
| parent | c6e970598c6c23f0606d1bc19036f0decd57cc05 (diff) | |
Merge branch 'release' into Feature/new-cart-popup
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 df47e87d..f438ae67 100644 --- a/src/core/components/elements/Navbar/TopBanner.jsx +++ b/src/core/components/elements/Navbar/TopBanner.jsx @@ -4,8 +4,9 @@ import odooApi from '@/core/api/odooApi'; import SmoothRender from '~/components/ui/smooth-render'; import Link from '../Link/Link'; import { background } from '@chakra-ui/react'; +import { useEffect } from '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} |
