/* eslint-disable eslint-comments/disable-enable-pair */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import axios from 'axios' import { Alert } from 'components/Alert' import { Anchor } from 'components/Anchor' import { Conditional } from 'components/Conditional' import { ContractPageHeader } from 'components/ContractPageHeader' import { useWallet } from 'contexts/wallet' import type { NextPage } from 'next' import { NextSeo } from 'next-seo' import { useCallback, useEffect, useState } from 'react' import { FaSlidersH, FaStar } from 'react-icons/fa' import { API_URL, BADGE_HUB_ADDRESS, STARGAZE_URL } from 'utils/constants' import { withMetadata } from 'utils/layout' import { links } from 'utils/links' const BadgeList: NextPage = () => { const wallet = useWallet() const [myBadges, setMyBadges] = useState([]) useEffect(() => { const fetchBadges = async () => { await axios .get(`${API_URL}/api/v1beta/badges/${wallet.address}`) .then((response) => { const badgeData = response.data setMyBadges(badgeData) }) .catch(console.error) } fetchBadges().catch(console.error) }, [wallet.address]) const renderTable = useCallback(() => { return (
{myBadges.length > 0 && ( {myBadges.map((badge: any, index: any) => { return ( ) })}
Badge Name Badge Description
Cover

{badge.name}

Badge ID: {badge.tokenId}

{badge.description} {/*
*/} {/* */}
)}
) }, [myBadges, wallet.address]) return (

{renderTable()}

You currently don't own any badges.
) } export default withMetadata(BadgeList, { center: false })