Fix: samakan format parsing response dengan event.html, tambah logging detail
This commit is contained in:
@@ -504,7 +504,12 @@ async function loadSummaryAndCharts() {
|
|||||||
async function loadGatesForCamera() {
|
async function loadGatesForCamera() {
|
||||||
try {
|
try {
|
||||||
const response = await apiGetGates(null, { limit: 1000 });
|
const response = await apiGetGates(null, { limit: 1000 });
|
||||||
let gates = Array.isArray(response) ? response : (response && Array.isArray(response.data) ? response.data : []);
|
let gates = [];
|
||||||
|
if (Array.isArray(response)) {
|
||||||
|
gates = response;
|
||||||
|
} else if (response && Array.isArray(response.data)) {
|
||||||
|
gates = response.data;
|
||||||
|
}
|
||||||
|
|
||||||
gatesCache = {};
|
gatesCache = {};
|
||||||
gates.forEach(gate => {
|
gates.forEach(gate => {
|
||||||
@@ -526,7 +531,7 @@ async function loadGatesForCamera() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('[Dashboard] Gates dengan camera loaded:', Object.keys(gatesCache).length);
|
console.log('[Dashboard] Gates dengan camera loaded:', Object.keys(gatesCache).length, gatesCache);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('[Dashboard] Error loading gates for camera:', err);
|
console.error('[Dashboard] Error loading gates for camera:', err);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user