diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-06-05 16:50:38 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-06-05 16:50:38 +0700 |
| commit | 755b61a8a7a082cc13f7ecb4a79807f90e60b3d6 (patch) | |
| tree | 9ca4fc8b49c9784c433c2fdc54f59934f2239b3b /src-migrate/modules/product-detail/components | |
| parent | f9f1fdf83c2b6ed5c1d85d7418d45aeed9b05c77 (diff) | |
<iman> add feature SNI-TKDN
Diffstat (limited to 'src-migrate/modules/product-detail/components')
| -rw-r--r-- | src-migrate/modules/product-detail/components/Image.tsx | 46 |
1 files changed, 3 insertions, 43 deletions
diff --git a/src-migrate/modules/product-detail/components/Image.tsx b/src-migrate/modules/product-detail/components/Image.tsx index 1b80efa8..30ca0d34 100644 --- a/src-migrate/modules/product-detail/components/Image.tsx +++ b/src-migrate/modules/product-detail/components/Image.tsx @@ -14,49 +14,9 @@ type Props = { const Image = ({ product }: Props) => { const flashSale = product.flash_sale - const [count, setCount] = useState(flashSale?.remaining_time || 0); - const [isSni, setIsSni] = useState(false); - const [isTkdn, setTkdn] = useState(false); - - useEffect(() => { - // Lakukan pemanggilan API untuk memeriksa isSni - const fetchSniData = async () => { - try { - const response = await fetch('URL_API_SNI'); - const data = await response.json(); - if (data && data.sni) { - setIsSni(true); - } else { - setIsSni(false); - } - } catch (error) { - console.error('Error fetching SNI data:', error); - setIsSni(false); - } - }; - - // Lakukan pemanggilan API untuk memeriksa isTkdn - const fetchTkdnData = async () => { - try { - const response = await fetch('URL_API_TKDN'); - const data = await response.json(); - if (data && data.tkdn) { - setTkdn(true); - } else { - setTkdn(false); - } - } catch (error) { - console.error('Error fetching TKDN data:', error); - setTkdn(false); - } - }; - fetchSniData(); - fetchTkdnData(); - return () => { - }; - }, []); + useEffect(() => { let interval: NodeJS.Timeout; @@ -95,7 +55,7 @@ const Image = ({ product }: Props) => { /> <div className="absolute top-4 right-10 flex "> <div className="gambarB "> - {!isSni && ( + {product.isSni && ( <ImageNext src="/images/sni-logo.png" alt="SNI Logo" @@ -106,7 +66,7 @@ const Image = ({ product }: Props) => { )} </div> <div className="gambarC "> - {!isTkdn && ( + {product.isTkdn && ( <ImageNext src="/images/TKDN.png" alt="TKDN" |
