rm unused urlparam
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
import { storedLocation, storedModel, storedUnits } from '$lib/stores/settings';
|
||||
|
||||
import { formatZoned } from '$lib/utils/date';
|
||||
import { readList, syncSearchParams } from '$lib/utils/url-state';
|
||||
import { listUnlessDefault, readList, syncSearchParams } from '$lib/utils/url-state';
|
||||
|
||||
import { ChartContainer, ChartToolbar } from '$lib/components/charts';
|
||||
import { Checkbox } from '$lib/components/ui/checkbox';
|
||||
@@ -71,10 +71,19 @@
|
||||
storedLocation.set(data.location);
|
||||
});
|
||||
|
||||
const DEFAULT_VARS = ['temperature_2m', 'rain', 'wind_speed_10m'];
|
||||
const DEFAULT_MODELS = [
|
||||
'ecmwf_ifs',
|
||||
'meteofrance_seamless',
|
||||
'ukmo_seamless',
|
||||
'icon_seamless',
|
||||
'gfs_seamless'
|
||||
];
|
||||
|
||||
let params = $state({
|
||||
...defaultParameters,
|
||||
hourly: ['temperature_2m', 'rain', 'wind_speed_10m'],
|
||||
models: ['ecmwf_ifs', 'meteofrance_seamless', 'ukmo_seamless', 'icon_seamless', 'gfs_seamless']
|
||||
hourly: [...DEFAULT_VARS],
|
||||
models: [...DEFAULT_MODELS]
|
||||
});
|
||||
|
||||
// units live in a persisted store; mirror them into params so a change
|
||||
@@ -125,8 +134,8 @@
|
||||
const vars = params.hourly;
|
||||
if (!mounted) return;
|
||||
syncSearchParams(get(page).url, {
|
||||
models: models?.length ? models.join(',') : null,
|
||||
vars: vars?.length ? vars.join(',') : null
|
||||
models: listUnlessDefault(models, DEFAULT_MODELS),
|
||||
vars: listUnlessDefault(vars, DEFAULT_VARS)
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user