21 lines
434 B
TypeScript
21 lines
434 B
TypeScript
|
import useNotificationStore from '../stores/useNotificationStore'
|
||
|
|
||
|
export function notify(newNotification: {
|
||
|
type?: string
|
||
|
message: string
|
||
|
description?: string
|
||
|
txid?: string
|
||
|
}) {
|
||
|
const {
|
||
|
notifications,
|
||
|
set: setNotificationStore,
|
||
|
} = useNotificationStore.getState()
|
||
|
|
||
|
setNotificationStore((state) => {
|
||
|
state.notifications = [
|
||
|
...notifications,
|
||
|
{ type: 'success', ...newNotification },
|
||
|
]
|
||
|
})
|
||
|
}
|