diff --git a/src/lib/components/alert.svelte b/src/lib/components/alert.svelte index 36e1ed44a..921f54b28 100644 --- a/src/lib/components/alert.svelte +++ b/src/lib/components/alert.svelte @@ -1,10 +1,10 @@ @@ -25,11 +25,11 @@

- {#if func?.length} + {#if buttons?.length}
- {#each func as f} - {/each}
diff --git a/src/lib/layout/notification.svelte b/src/lib/layout/notification.svelte index ca5b33c4b..7b77e5d51 100644 --- a/src/lib/layout/notification.svelte +++ b/src/lib/layout/notification.svelte @@ -4,7 +4,7 @@ export let type: Notification['type'] = 'info'; export let title: Notification['title']; - export let func: Notification['func']; + export let buttons: Notification['buttons']; let icon: string; switch (type) { @@ -44,11 +44,11 @@ {/if}

- {#if func} + {#if buttons}
- {#each func as f} - {/each}
diff --git a/src/lib/layout/notifications.svelte b/src/lib/layout/notifications.svelte index dde7dcdda..7b019f930 100644 --- a/src/lib/layout/notifications.svelte +++ b/src/lib/layout/notifications.svelte @@ -11,7 +11,7 @@ type={notification.type} title={notification.title} on:dismiss={() => dismissNotification(notification.id)} - func={notification?.func}> + buttons={notification?.buttons}> {notification.message} {/each} diff --git a/src/lib/stores/notifications.ts b/src/lib/stores/notifications.ts index ce67f7899..0642824df 100644 --- a/src/lib/stores/notifications.ts +++ b/src/lib/stores/notifications.ts @@ -7,11 +7,11 @@ export type Notification = { timeout?: number; message: string; title?: string; - func?: Func[]; + buttons?: Buttons[]; }; -export type Func = { - method: () => void; //TODO Check if promise is needed rather tha () => void +export type Buttons = { + method: () => void | Promise; name: string; };