Files
pages/theseus_gui/src/store/notifications.js
Wyatt Verchere 6a76811bed Offline mode (#403)
* offline mode

* fixes, mixpanels, etc

* changes

* prettier

* rev

* actions
2023-08-04 19:51:46 -07:00

30 lines
626 B
JavaScript

import { defineStore } from 'pinia'
export const useNotifications = defineStore('notificationsStore', {
state: () => ({
notificationsWrapper: null,
}),
actions: {
setNotifs(notifs) {
this.notificationsWrapper = notifs
},
addNotification(notif) {
this.notificationsWrapper.addNotification(notif)
},
},
})
export const handleError = (err) => {
const notifs = useNotifications()
notifs.addNotification({
title: 'An error occurred',
text: err.message ?? err,
type: 'error',
})
console.error(err)
}
export const handleMixpanelError = (err) => {
console.error(err)
}