Fix settings saving
This commit is contained in:
parent
912f3265ae
commit
4e0450faca
@ -1,4 +1,6 @@
|
||||
<script>
|
||||
import { tick } from 'svelte';
|
||||
|
||||
import {
|
||||
Container,
|
||||
Form,
|
||||
@ -19,13 +21,18 @@
|
||||
$: settingsP.then((s) => settings = s);
|
||||
|
||||
let settings;
|
||||
|
||||
async function submitSettings() {
|
||||
await tick();
|
||||
settings.save();
|
||||
}
|
||||
</script>
|
||||
|
||||
<Container class="flex-fill d-flex flex-column py-2">
|
||||
<h2>
|
||||
Paramètres
|
||||
</h2>
|
||||
<Form>
|
||||
<Form on:submit={submitSettings}>
|
||||
{#await settingsP}
|
||||
<div class="d-flex justify-content-center align-items-center gap-2">
|
||||
<Spinner color="primary" /> Chargement en cours…
|
||||
@ -39,7 +46,7 @@
|
||||
id="gongIntervals"
|
||||
placeholder="20"
|
||||
bind:value={settings.gong_interval}
|
||||
on:change={() => settings.save()}
|
||||
on:input={submitSettings}
|
||||
/>
|
||||
<InputGroupText>min</InputGroupText>
|
||||
</InputGroup>
|
||||
@ -53,7 +60,7 @@
|
||||
id="weatherDelay"
|
||||
placeholder="5"
|
||||
bind:value={settings.weather_delay}
|
||||
on:change={() => settings.save()}
|
||||
on:input={submitSettings}
|
||||
/>
|
||||
<InputGroupText>min</InputGroupText>
|
||||
</InputGroup>
|
||||
@ -66,7 +73,7 @@
|
||||
type="select"
|
||||
id="weatherRituel"
|
||||
bind:value={settings.weather_action}
|
||||
on:change={() => settings.save()}
|
||||
on:input={submitSettings}
|
||||
>
|
||||
{#each $actions.list as action (action.id)}
|
||||
<option value="{action.path}">{action.name}</option>
|
||||
@ -86,8 +93,8 @@
|
||||
<Input
|
||||
type="select"
|
||||
id="greetingLanguage"
|
||||
bind:value={settings.lang}
|
||||
on:change={() => settings.save()}
|
||||
bind:value={settings.language}
|
||||
on:input={submitSettings}
|
||||
>
|
||||
<option value="fr_FR">Français</option>
|
||||
<option value="en_US">Anglais</option>
|
||||
@ -104,7 +111,7 @@
|
||||
id="maxRunTime"
|
||||
placeholder="60"
|
||||
bind:value={settings.max_run_time}
|
||||
on:change={() => settings.save()}
|
||||
on:input={submitSettings}
|
||||
/>
|
||||
<InputGroupText>min</InputGroupText>
|
||||
</InputGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user