cambiando url de apis
This commit is contained in:
parent
58a1eee20e
commit
a6c73ccf06
|
|
@ -50,17 +50,18 @@ function updateMonthHeader() {
|
||||||
// ====================
|
// ====================
|
||||||
async function loadStats(options = {}) {
|
async function loadStats(options = {}) {
|
||||||
try {
|
try {
|
||||||
const url = buildApiUrl({
|
const url = buildApiUrl({ ciudad: ciudadActual, ...options });
|
||||||
ciudad: ciudadActual,
|
|
||||||
...options
|
|
||||||
});
|
|
||||||
|
|
||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
if (!response.ok) throw new Error("Error cargando datos: " + response.status);
|
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");
|
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);
|
renderLastData(data);
|
||||||
renderMonthStats(data);
|
renderMonthStats(data);
|
||||||
renderTrend(data);
|
renderTrend(data);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue