diff --git a/index.html b/index.html index 86cca0c..a2d1018 100644 --- a/index.html +++ b/index.html @@ -555,11 +555,21 @@ try { const res = await fetch('https://n8n.odoo4projects.com/webhook/odoo-expertos'); const data = await res.json(); - // Response is [{ data: [...] }] - allExperts = (data[0] && data[0].data) || []; + // 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; + } else { + allExperts = []; + } renderExperts(allExperts); } catch (err) { - document.getElementById('expertGridLoading').innerHTML = '
Error al cargar expertos. Intenta de nuevo más tarde.
'; + document.getElementById('expertGridLoading').innerHTML = + 'El mercado de expertos se está cargando. Vuelve a intentarlo en unos momentos.
'; } }