cambiando url de apis
This commit is contained in:
parent
58a1eee20e
commit
a6c73ccf06
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue