diff --git a/frontend/package.json b/frontend/package.json
index 0e0242e..972df35 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
- "dev": "vite",
+ "dev": "vite --host",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json"
diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte
index 669f3cf..59a9c8c 100644
--- a/frontend/src/App.svelte
+++ b/frontend/src/App.svelte
@@ -8,8 +8,8 @@
let info: Info;
let alarms: Alarm[];
- onMount(async () => {
- Promise.all([
+ function fetchdata() {
+ return Promise.all([
fetch("/api/info")
.then((r) => r.json())
.then((data) => {
@@ -21,6 +21,10 @@
alarms = data;
}),
]);
+ }
+
+ onMount(async () => {
+ await fetchdata();
});
@@ -33,7 +37,9 @@
{#if alarms}
{#each alarms as alarm}
-
+
{
+ fetchdata();
+ }} />
{/each}
{/if}
diff --git a/frontend/src/lib/AddAlarm.svelte b/frontend/src/lib/AddAlarm.svelte
index 6339c44..aaebe8c 100644
--- a/frontend/src/lib/AddAlarm.svelte
+++ b/frontend/src/lib/AddAlarm.svelte
@@ -11,7 +11,8 @@
-
+
+
{#if closed}
{:else}
-
+
+ {#if info.nextAlarmIn}
-
in {duration.sprintf("%hh %mm")}
+
in {Duration.parse(info.nextAlarmIn).sprintf("%hh %mm")}
+ {/if}
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 9077f7a..1f916ff 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -1,8 +1,8 @@
export interface Info {
alarms: number
deviceId: string
- nextAlarmAt: string
- nextAlarmIn: string
+ nextAlarmAt?: string
+ nextAlarmIn?: string
serverTime: string
spotifyUser: string
timezone: string
@@ -13,4 +13,5 @@ export interface Info {
export interface Alarm {
name: string
time: string
+ disabled: boolean
}