diff --git a/src/components/UI/pages/profile/ProfileContent.jsx b/src/components/UI/pages/profile/ProfileContent.jsx index 3c92c78..86dbf88 100644 --- a/src/components/UI/pages/profile/ProfileContent.jsx +++ b/src/components/UI/pages/profile/ProfileContent.jsx @@ -15,6 +15,7 @@ const ProfileContent = () => { // eslint-disable-next-line react-hooks/exhaustive-deps async function accountLog() { let address = localStorage.getItem("userAddress"); + if (!address) window.location = "/connectWallet"; try { const response = await Moralis.EvmApi.wallets.getWalletActiveChains({ address: address, @@ -132,6 +133,8 @@ const ProfileContent = () => { apiKey: moralisApiKey, }); accountLog(); + let randomNum = Math.floor(Math.random() * randomAvatart.length); + setWalletAvatar(randomAvatart[randomNum]); }, []); useEffect(() => { if (!localStorage.state) { @@ -161,9 +164,6 @@ const ProfileContent = () => { if (followBtnSvg) followBtnSvg.remove(); } - let randomNum = Math.floor(Math.random() * randomAvatart.length); - setWalletAvatar(randomAvatart[randomNum]); - let address = localStorage.getItem("userAddress"); setWalletAddress(address); setWalletAddressClip(address.substring(0, 6) + "..." + address.slice(-4)); @@ -187,8 +187,20 @@ const ProfileContent = () => { style={{ maxWidth: 470 }} >