From 2330953c33274b8fad79d6d3748fc7207addff48 Mon Sep 17 00:00:00 2001 From: creations Date: Thu, 1 May 2025 20:20:55 -0400 Subject: [PATCH] fix issue with empty badge loading --- public/js/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/js/index.js b/public/js/index.js index 1dd67aa..aa086f7 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -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; }