2024-04-15 13:58:20 -07:00
|
|
|
import { defineStore } from 'pinia'
|
|
|
|
|
|
|
|
|
|
export const useError = defineStore('errorsStore', {
|
|
|
|
|
state: () => ({
|
|
|
|
|
errorModal: null,
|
|
|
|
|
}),
|
|
|
|
|
actions: {
|
|
|
|
|
setErrorModal(ref) {
|
|
|
|
|
this.errorModal = ref
|
|
|
|
|
},
|
2024-08-21 21:24:35 -07:00
|
|
|
showError(error, context, closable = true, source = null) {
|
|
|
|
|
this.errorModal.show(error, context, closable, source)
|
2024-04-15 13:58:20 -07:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
2024-08-21 21:24:35 -07:00
|
|
|
export const handleSevereError = (err, context) => {
|
2024-04-15 13:58:20 -07:00
|
|
|
const error = useError()
|
2024-08-21 21:24:35 -07:00
|
|
|
error.showError(err, context)
|
2024-04-15 13:58:20 -07:00
|
|
|
console.error(err)
|
|
|
|
|
}
|