fix(bandeja): corregir res.data → top-level keys (jsonOk no anida en data)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-27 21:21:01 -05:00
co-authored by Claude Sonnet 4.6
parent 0c6e522106
commit 6c54674795
+4 -4
View File
@@ -432,14 +432,14 @@ async function _bndRefrescarLista() {
const res = await fetch(BND_API).then(r => r.json()).catch(() => null); const res = await fetch(BND_API).then(r => r.json()).catch(() => null);
if (!res?.ok) return; if (!res?.ok) return;
_bndListData = res.data; _bndListData = res;
const s = res.data.stats; const s = res.stats;
document.getElementById('st-total').innerHTML = `<i class="fas fa-users"></i> Total: ${s.total}`; document.getElementById('st-total').innerHTML = `<i class="fas fa-users"></i> Total: ${s.total}`;
document.getElementById('st-activos').innerHTML = `<i class="fas fa-circle" style="font-size:.55rem"></i> Activos: ${s.activos}`; document.getElementById('st-activos').innerHTML = `<i class="fas fa-circle" style="font-size:.55rem"></i> Activos: ${s.activos}`;
document.getElementById('st-cerr').innerHTML = `<i class="fas fa-check-double"></i> Cerrados: ${s.cerrados}`; document.getElementById('st-cerr').innerHTML = `<i class="fas fa-check-double"></i> Cerrados: ${s.cerrados}`;
document.getElementById('st-mp').innerHTML = `<i class="fas fa-exclamation-triangle"></i> Muestras pend.: ${s.muestras_pendientes}`; document.getElementById('st-mp').innerHTML = `<i class="fas fa-exclamation-triangle"></i> Muestras pend.: ${s.muestras_pendientes}`;
_renderLista(res.data.activos, res.data.cerrados); _renderLista(res.activos, res.cerrados);
} }
function _renderLista(activos, cerrados) { function _renderLista(activos, cerrados) {
@@ -491,7 +491,7 @@ async function _bndVerDetalle(turnoId) {
const res = await fetch(`${BND_API}?turno_id=${turnoId}`).then(r => r.json()).catch(() => null); const res = await fetch(`${BND_API}?turno_id=${turnoId}`).then(r => r.json()).catch(() => null);
if (!res?.ok) { det.innerHTML = `<div class="bnd-empty"><i class="fas fa-times-circle"></i><p>Error al cargar</p></div>`; return; } if (!res?.ok) { det.innerHTML = `<div class="bnd-empty"><i class="fas fa-times-circle"></i><p>Error al cargar</p></div>`; return; }
_renderDetalle(res.data); _renderDetalle(res);
} }
function _renderDetalle(d) { function _renderDetalle(d) {