mango-ui-v3/utils/notifications.tsx

19 lines
431 B
TypeScript
Raw Normal View History

2021-04-11 21:17:23 -07:00
import useMangoStore from '../stores/useMangoStore'
export function notify(newNotification: {
type?: string
message: string
description?: string
txid?: string
}) {
const setMangoStore = useMangoStore.getState().set
const notifications = useMangoStore.getState().notifications
2021-04-11 21:17:23 -07:00
setMangoStore((state) => {
state.notifications = [
...notifications,
2021-04-11 21:17:23 -07:00
{ type: 'success', ...newNotification },
]
})
2021-04-02 11:26:21 -07:00
}