fix issue with empty badge loading
All checks were successful
Code quality checks / biome (push) Successful in 9s

This commit is contained in:
creations 2025-05-01 20:20:55 -04:00
parent 88b3783451
commit 2330953c33
Signed by: creations
GPG key ID: 8F553AA4320FC711

View file

@ -283,7 +283,13 @@ async function loadBadges(userId, options = {}) {
const res = await fetch(url);
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.";
return;
}