11 lines
351 B
TypeScript
11 lines
351 B
TypeScript
import type { PageServerLoad } from './$types.js';
|
|
import { fetchStations } from '$lib/api.js';
|
|
|
|
export const load: PageServerLoad = async ({ fetch }) => {
|
|
try {
|
|
return { stations: await fetchStations(fetch) };
|
|
} catch {
|
|
return { stations: [], loadError: 'Impossibile caricare le centraline. Controlla la connessione e riprova.' };
|
|
}
|
|
};
|