cambiando url de apis

This commit is contained in:
Tatiana Villa 2026-02-21 17:43:55 +01:00
parent 58a1eee20e
commit a6c73ccf06
1 changed files with 6 additions and 5 deletions

View File

@ -50,17 +50,18 @@ function updateMonthHeader() {
// ====================
async function loadStats(options = {}) {
try {
const url = buildApiUrl({
ciudad: ciudadActual,
...options
});
const url = buildApiUrl({ ciudad: ciudadActual, ...options });
const response = await fetch(url);
if (!response.ok) throw new Error("Error cargando datos: " + response.status);
const data = await response.json();
let data = await response.json(); // Cambia 'const' por 'let'
if (!data || !data.length) throw new Error("Datos vacíos");
// --- FILTRADO POR CIUDAD (Importante mientras Java no filtre) ---
data = data.filter(d => d.ciudad === ciudadActual);
// ----------------------------------------------------------------
renderLastData(data);
renderMonthStats(data);
renderTrend(data);