From 09663e3dc85e598c132026f3366f69d9d4e319e7 Mon Sep 17 00:00:00 2001 From: oliver Date: Mon, 22 Jun 2026 18:25:22 -0300 Subject: [PATCH] Update app.js --- app.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index cc30b90..9d7f031 100644 --- a/app.js +++ b/app.js @@ -1402,9 +1402,17 @@ async function loadAffiliateLinks() { function renderAffiliateLinks(data) { const body = document.getElementById("affiliate-links-body"); if (!body) return; - const rows = Array.isArray(data) ? data : data && data.data ? data.data : []; - const areas = - rows.length && Array.isArray(rows[0].areas) ? rows[0].areas : []; + // data is either { areas: [...] } or [{ areas: [...] }] or { data: [...] } + let areas = []; + if (data && Array.isArray(data.areas)) { + areas = data.areas; + } else if (data && Array.isArray(data.data)) { + const first = data.data[0]; + if (first && Array.isArray(first.areas)) areas = first.areas; + } else if (Array.isArray(data)) { + const first = data[0]; + if (first && Array.isArray(first.areas)) areas = first.areas; + } const filtered = areas.filter((a) => a.text && a.link); if (!filtered.length) { body.innerHTML =