From cfc64998a3a36da1dc5fc3b7618503423c641c16 Mon Sep 17 00:00:00 2001 From: Harpreet Singh Date: Wed, 27 Mar 2024 19:25:25 +0530 Subject: [PATCH] refactor: client side with useffect --- apps/www/registry/default/ui/nft-card.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/www/registry/default/ui/nft-card.tsx b/apps/www/registry/default/ui/nft-card.tsx index 0d74536..dfd1a1f 100644 --- a/apps/www/registry/default/ui/nft-card.tsx +++ b/apps/www/registry/default/ui/nft-card.tsx @@ -44,6 +44,7 @@ const NftCard = async ({ ...props }: NftCardProps) => { const [nftData, setNftData] = useState(null) + const umi = createUmi(process.env.NEXT_PUBLIC_QUICKNODE!).use( mplTokenMetadata() ) @@ -51,7 +52,20 @@ const NftCard = async ({ useEffect(() => { const fetchNftData = async () => { const nftData = await fetchDigitalAsset(umi, publicKey(mintAddress)) - setNftData(nftData) + const uriData = await fetch( + "https://madlads.s3.us-west-2.amazonaws.com/json/1976.json", + { + method: "GET", + headers: { + Accept: "*/*", + }, + } + ) + const jsonUriData = await uriData.json() + setNftData({ + nft: nftData, + uriData: jsonUriData, + }) } fetchNftData() }, [])