Skip to content

Commit

Permalink
Update function accountLog()
Browse files Browse the repository at this point in the history
  • Loading branch information
enndylove committed Dec 10, 2023
1 parent 45dc5dc commit d434ca5
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/components/UI/pages/profile/ProfileContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -132,6 +133,8 @@ const ProfileContent = () => {
apiKey: moralisApiKey,
});
accountLog();
let randomNum = Math.floor(Math.random() * randomAvatart.length);
setWalletAvatar(randomAvatart[randomNum]);
}, []);
useEffect(() => {
if (!localStorage.state) {
Expand Down Expand Up @@ -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));
Expand All @@ -187,8 +187,20 @@ const ProfileContent = () => {
style={{ maxWidth: 470 }}
>
<div className="profile__content position-relative w-100">
<img src={IBanner} alt="" className="profile__banner w-100 h-100" />
<img src={walletAvatar} alt="" className="profile__avatar" />
<img
loading="lazy"
data-src={IBanner}
src={IBanner}
alt=""
className="profile__banner w-100 h-100"
/>
<img
loading="lazy"
data-src={walletAvatar}
src={walletAvatar}
alt=""
className="profile__avatar"
/>
<div className="profile__content-info">
<div className="profile__content-content">
<h4 className="profile__content-name font-h4 color-darken d-flex align-items-center flex-wrap">
Expand Down

0 comments on commit d434ca5

Please sign in to comment.