2021-04-11 21:17:23 -07:00
|
|
|
import useMangoStore from '../stores/useMangoStore'
|
|
|
|
|
|
|
|
export function notify(newNotification: {
|
2021-07-06 15:04:20 -07:00
|
|
|
type?: 'success' | 'info' | 'error'
|
|
|
|
title: string
|
2021-04-11 21:17:23 -07:00
|
|
|
description?: string
|
|
|
|
txid?: string
|
|
|
|
}) {
|
|
|
|
const setMangoStore = useMangoStore.getState().set
|
2021-04-12 13:01:55 -07:00
|
|
|
const notifications = useMangoStore.getState().notifications
|
2021-04-11 21:17:23 -07:00
|
|
|
|
|
|
|
setMangoStore((state) => {
|
|
|
|
state.notifications = [
|
2021-04-12 13:01:55 -07:00
|
|
|
...notifications,
|
2021-04-11 21:17:23 -07:00
|
|
|
{ type: 'success', ...newNotification },
|
|
|
|
]
|
|
|
|
})
|
2021-04-02 11:26:21 -07:00
|
|
|
}
|