Made everything a bit more consistent.

This commit is contained in:
zenodeapp 2023-12-01 16:43:06 +01:00
parent 5737bc6a33
commit ccf63cd413
2 changed files with 13 additions and 13 deletions

View File

@ -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) || '<Invalid>';
addresses.value.hex = consensusPubkeyToHexAddress(
@ -208,7 +209,7 @@ function pageload(p: number) {
class="object-contain"
@error="
(e) => {
loadAvatar();
loadAvatar(identity);
}
"
/>

View File

@ -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);
}
"
/>