Fix settings saving
This commit is contained in:
parent
912f3265ae
commit
30828841fb
@ -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>
|
||||
@ -62,11 +69,12 @@
|
||||
<FormGroup>
|
||||
<Label for="weatherRituel">Rituel pour l'annonce météo</Label>
|
||||
{#if $actions.list}
|
||||
{JSON.stringify(settings)}
|
||||
<Input
|
||||
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 +94,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 +112,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