import { get } from 'svelte/store'; import { redirect } from '@sveltejs/kit'; import { storedLocation } from '$lib/stores/settings'; import { geoLocationNameToRoute } from '$lib/utils/meteo'; import type { PageLoad } from './$types'; export const prerender = true; export const load = (async () => { const location = get(storedLocation); const locationRoute = geoLocationNameToRoute(location.name); throw redirect( 303, '/weather/week/' + (location.population ? location.population > 543000 ? locationRoute : locationRoute + '_' + location.id : locationRoute + '_' + location.id) ); }) satisfies PageLoad;