diff --git a/src/modules/[chain]/staking/[validator].vue b/src/modules/[chain]/staking/[validator].vue index ba44b7db..071d7ddd 100644 --- a/src/modules/[chain]/staking/[validator].vue +++ b/src/modules/[chain]/staking/[validator].vue @@ -111,8 +111,9 @@ const fetchAvatar = (identity: string) => { }); }; -const loadAvatar = () => { - fetchAvatar(identity.value).then(() => { +const loadAvatar = (identity: string) => { + // fetches avatar from keybase and stores it in localStorage + fetchAvatar(identity).then(() => { localStorage.setItem('avatars', JSON.stringify(avatars.value)); }); }; @@ -122,7 +123,7 @@ onMounted(() => { staking.fetchValidator(validator).then((res) => { v.value = res.validator; identity.value = res.validator?.description?.identity || ''; - if (identity.value && !avatars.value[identity.value]) loadAvatar(); + if (identity.value && !avatars.value[identity.value]) loadAvatar(identity.value); const prefix = valoperToPrefix(v.value.operator_address) || ''; addresses.value.hex = consensusPubkeyToHexAddress( @@ -208,7 +209,7 @@ function pageload(p: number) { class="object-contain" @error=" (e) => { - loadAvatar(); + loadAvatar(identity); } " /> diff --git a/src/modules/[chain]/staking/index.vue b/src/modules/[chain]/staking/index.vue index 490d5b7c..e93aa69d 100644 --- a/src/modules/[chain]/staking/index.vue +++ b/src/modules/[chain]/staking/index.vue @@ -164,17 +164,15 @@ const fetchAvatar = (identity: string) => { }); }; -const loadAvatar = (validator: Validator) => { - const identity = validator.description?.identity; - - if (identity) { - fetchAvatar(identity).then(() => { - localStorage.setItem('avatars', JSON.stringify(avatars.value)); - }); - } +const loadAvatar = (identity: string) => { + // fetches avatar from keybase and stores it in localStorage + fetchAvatar(identity).then(() => { + localStorage.setItem('avatars', JSON.stringify(avatars.value)); + }); }; const loadAvatars = () => { + // fetches all avatars from keybase and stores it in localStorage const promises = staking.validators.map((validator) => { const identity = validator.description?.identity; @@ -340,7 +338,8 @@ loadAvatars(); class="object-contain" @error=" (e) => { - loadAvatar(v); + const identity = v.description?.identity; + if (identity) loadAvatar(identity); } " />