FAQ: avisar cuando el webhook responde sin datos
Si n8n devuelve {"message":"Workflow was started"} en vez de la lista, la
página lo explica en lugar de mostrar 'sin resultados'.
This commit is contained in:
1 parent
ed645942a4
commit
399cc1a3a5
1 file changed
+5
-1
+5
-1
@@ -132,8 +132,12 @@ async function load() {
|
||||
try {
|
||||
const res = await fetch(API, { headers: { Accept: 'application/json' } });
|
||||
if (!res.ok) throw new Error('HTTP ' + res.status);
|
||||
items = normalize(await res.json());
|
||||
const payload = await res.json();
|
||||
items = normalize(payload);
|
||||
render();
|
||||
if (!items.length && !Array.isArray(payload)) {
|
||||
flash('El webhook respondió sin datos (' + JSON.stringify(payload) + '). En n8n, poné el nodo Webhook en "Respond: When Last Node Finishes" para que devuelva la lista.', 'err');
|
||||
}
|
||||
} catch (err) {
|
||||
el('list').innerHTML = '';
|
||||
flash('No se pudo leer el webhook (' + err.message + '). Si es CORS, hay que habilitar el origen https://oca-py.org en n8n.', 'err');
|
||||
|
||||
Reference in new issue
Block a user