diff --git a/src/custom/hooks/useFetchProfile.ts b/src/custom/hooks/useFetchProfile.ts index e49393102..c2d95af4e 100644 --- a/src/custom/hooks/useFetchProfile.ts +++ b/src/custom/hooks/useFetchProfile.ts @@ -5,13 +5,13 @@ import { ProfileData } from 'api/gnosisProtocol/api' type FetchProfileState = { profileData: ProfileData | null - //error: string + error: string isLoading: boolean } const emptyState: FetchProfileState = { profileData: null, - //error: '', + error: '', isLoading: false, } diff --git a/src/custom/pages/Profile/index.tsx b/src/custom/pages/Profile/index.tsx index 06ebb22a5..679dd331c 100644 --- a/src/custom/pages/Profile/index.tsx +++ b/src/custom/pages/Profile/index.tsx @@ -26,9 +26,24 @@ import { SupportedChainId as ChainId } from 'constants/chains' export default function Profile() { const referralLink = useReferralLink() const { account, chainId } = useActiveWeb3React() - const { profileData, isLoading } = useFetchProfile() + const { profileData, isLoading, error } = useFetchProfile() const lastUpdated = useTimeAgo(profileData?.lastUpdated) + const renderNotificationMessages = ( + <> + {error && ( + + There was an error loading your profile data. Please try again later. + + )} + {chainId && chainId !== ChainId.MAINNET && ( + + Profile data is only available for mainnet. Please change the network to see it. + + )} + + ) + return ( @@ -57,11 +72,7 @@ export default function Profile() { )} - {chainId && chainId !== ChainId.MAINNET && ( - - Profile data is only available for mainnet. Please change the network to see it. - - )} + {renderNotificationMessages} Your referral url