Hey guys,
I’m trying to understand how to display the tokens owned by a current user on front end . Right now, here is what I am doing:
const Profile = () => {
const {isWeb3Enabled, account} = useMoralis()
const { data: ownerWhoopys, isFetching: fetchingListedWhoopys } =
useMoralisQuery("CreatedWhoopys", (query) =>
query.equalTo("creatorAddress", account).limit(100)
);
console.log(ownerWhoopys);
console.log(account)
When I call the following function on my front end, it returns blank:
<div>
{ownerWhoopys.map((whoopy) => {
console.log(whoopy.attributes)
const { whoopyName, whoopyColor, strength, creatorAddress } =
whoopy.attributes
return (
<WhoopyCard
whoopyName={whoopyName}
whoopyColor={whoopyColor}
strength={strength}
creatorAddress={creatorAddress}
/>
)
})
}
</div>
On my main page, to display all the createdWhoopys, I use the following function which works perfectly:
const { data: listedWhoopys, isFetching: fetchingListedWhoopys } =
useMoralisQuery("CreatedWhoopys", (query) =>
query.limit(100).ascending("whoopyName")
);
console.log(listedWhoopys);
//I then use the same html/js syntax as above to display the WhoopyCards
How can I get this to work on the profile page so as to show only the whoopys created by the current user?
Thanks!