Skip to content

Commit

Permalink
refactor: client side with useffect
Browse files Browse the repository at this point in the history
  • Loading branch information
siinghd committed Mar 27, 2024
1 parent 9eebe7e commit cfc6499
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion apps/www/registry/default/ui/nft-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,28 @@ const NftCard = async ({
...props
}: NftCardProps) => {
const [nftData, setNftData] = useState<any>(null)

const umi = createUmi(process.env.NEXT_PUBLIC_QUICKNODE!).use(
mplTokenMetadata()
)

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()
}, [])
Expand Down

0 comments on commit cfc6499

Please sign in to comment.