From f9b2c8a35631f45f77df2d270b82b3dc3c2a5b9d Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Fri, 7 Aug 2026 15:27:50 +0000 Subject: [PATCH] Fix GET response parsing: {data: [...]} format, include extra field in tags --- index.html | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index a2d1018..d98fe07 100644 --- a/index.html +++ b/index.html @@ -554,15 +554,12 @@ async function loadExperts() { try { const res = await fetch('https://n8n.odoo4projects.com/webhook/odoo-expertos'); - const data = await res.json(); - // Response can be either: - // [{ data: [...] }] - proper expert list - // { headers: {...}, body: {}, ... } - webhook metadata (not configured yet) - // or other format - if (Array.isArray(data) && data[0] && Array.isArray(data[0].data)) { - allExperts = data[0].data; - } else if (Array.isArray(data) && data.length > 0) { - allExperts = data; + const json = await res.json(); + // Response: { "data": [...] } + if (json && json.data && Array.isArray(json.data)) { + allExperts = json.data; + } else if (Array.isArray(json)) { + allExperts = json; } else { allExperts = []; } @@ -587,7 +584,8 @@ const initials = ex.name ? ex.name.split(' ').map(w => w[0]).join('').slice(0, 2).toUpperCase() : '??'; const skills = ex.skills ? ex.skills.split(',').map(s => s.trim()) : []; const modules = ex.modules ? ex.modules.split(',').map(s => s.trim()) : []; - const tags = [...skills, ...modules].filter(Boolean).slice(0, 6); + const extra = ex.extra ? ex.extra.split(',').map(s => s.trim()) : []; + const tags = [...skills, ...modules, ...extra].filter(Boolean).slice(0, 8); const certified = ex.certified === 'yes' || ex.certified === true; const hasRefs = ex.references && ex.references.length > 0;