Added UI with station cards, grouping and styling
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
export async function fetchStations() {
|
||||
const res = await fetch('/api/campagne_map_data');
|
||||
if (!res.ok) throw new Error(`Errore HTTP ${res.status}`);
|
||||
const geojson = await res.json();
|
||||
return geojson.features
|
||||
.map(f => ({ ...f.properties, pk: parseInt(f.properties.pk, 10) }))
|
||||
.sort((a, b) => b.pk - a.pk);
|
||||
}
|
||||
|
||||
export async function fetchDay(id, date) {
|
||||
try {
|
||||
const res = await fetch(`/api/get_measurements/${id}?day=${date}`);
|
||||
if (!res.ok) return [];
|
||||
const data = await res.json();
|
||||
return data.misure ?? [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user