You've already forked AstralRinth
bacc10d2f5
* add log * add log * Revert "add log" This reverts commit 2412a3de5f58fa6937b33b8e9c13fc47756670df. * add new minecraft auth error modal * add other auth errors * polish the styles * update link text * add unknown error state * pnpm prepr * fix link * fix lint
34 lines
769 B
JavaScript
34 lines
769 B
JavaScript
import { defineStore } from 'pinia'
|
|
|
|
export const useError = defineStore('errorsStore', {
|
|
state: () => ({
|
|
errorModal: null,
|
|
minecraftAuthErrorModal: null,
|
|
}),
|
|
actions: {
|
|
setErrorModal(ref) {
|
|
this.errorModal = ref
|
|
},
|
|
setMinecraftAuthErrorModal(ref) {
|
|
this.minecraftAuthErrorModal = ref
|
|
},
|
|
showError(error, context, closable = true, source = null) {
|
|
if (
|
|
error.message &&
|
|
error.message.includes('Minecraft authentication error:') &&
|
|
this.minecraftAuthErrorModal
|
|
) {
|
|
this.minecraftAuthErrorModal.show(error)
|
|
return
|
|
}
|
|
this.errorModal.show(error, context, closable, source)
|
|
},
|
|
},
|
|
})
|
|
|
|
export const handleSevereError = (err, context) => {
|
|
const error = useError()
|
|
error.showError(err, context)
|
|
console.error(err)
|
|
}
|