flaschengeist-frontend/src/store/modules/connectionError.js

44 lines
645 B
JavaScript

const state = {
errors: []
}
const mutations = {
addError: state => {
state.errors.push({
message: 'Connection Error: Server nicht verfügbar!',
visible: true
})
},
deleteErrors: state => {
state.errors = []
}
}
const actions = {
addError: ({ commit }) => {
commit('addError')
},
deleteErrors: ({ commit }) => {
commit('deleteErrors')
}
}
const getters = {
errors: state => {
return state.errors
},
visible: state => {
return state.errors.find(error => {
return error.visible
})
}
}
export default {
namespaced: true,
state,
mutations,
actions,
getters
}