fix issue with empty badge loading
All checks were successful
Code quality checks / biome (push) Successful in 9s
All checks were successful
Code quality checks / biome (push) Successful in 9s
This commit is contained in:
parent
88b3783451
commit
2330953c33
1 changed files with 7 additions and 1 deletions
|
@ -283,7 +283,13 @@ async function loadBadges(userId, options = {}) {
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
const json = await res.json();
|
const json = await res.json();
|
||||||
|
|
||||||
if (!res.ok || !json.badges) {
|
if (
|
||||||
|
!res.ok ||
|
||||||
|
!json.badges ||
|
||||||
|
Object.values(json.badges).every(
|
||||||
|
(arr) => !Array.isArray(arr) || arr.length === 0,
|
||||||
|
)
|
||||||
|
) {
|
||||||
target.textContent = "Failed to load badges.";
|
target.textContent = "Failed to load badges.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue