|
|
|
@ -1,13 +1,16 @@ |
|
|
|
import { writable } from 'svelte/store' |
|
|
|
import { writable } from "svelte/store" |
|
|
|
import { generate } from "shortid" |
|
|
|
|
|
|
|
export const notificationStore = writable({ |
|
|
|
notifications: [] |
|
|
|
notifications: [], |
|
|
|
}) |
|
|
|
|
|
|
|
export function send(message, type = 'default') { |
|
|
|
export function send(message, type = "default") { |
|
|
|
notificationStore.update(state => { |
|
|
|
state.notifications = [...state.notifications, { id: generate(), type, message }] |
|
|
|
state.notifications = [ |
|
|
|
...state.notifications, |
|
|
|
{ id: generate(), type, message }, |
|
|
|
] |
|
|
|
return state |
|
|
|
}) |
|
|
|
} |
|
|
|
@ -16,5 +19,5 @@ export const notifier = { |
|
|
|
danger: msg => send(msg, "danger"), |
|
|
|
warning: msg => send(msg, "warning"), |
|
|
|
info: msg => send(msg, "info"), |
|
|
|
success: msg => send(msg, "success") |
|
|
|
} |
|
|
|
success: msg => send(msg, "success"), |
|
|
|
} |
|
|
|
|