errorLog.js 480 B

1234567891011121314151617181920212223
  1. const state = () => ({
  2. errorLogs: [],
  3. })
  4. const getters = {
  5. errorLogs: (state) => state.errorLogs,
  6. }
  7. const mutations = {
  8. addErrorLog(state, errorLog) {
  9. state.errorLogs.push(errorLog)
  10. },
  11. clearErrorLog: (state) => {
  12. state.errorLogs.splice(0)
  13. },
  14. }
  15. const actions = {
  16. addErrorLog({ commit }, errorLog) {
  17. commit('addErrorLog', errorLog)
  18. },
  19. clearErrorLog({ commit }) {
  20. commit('clearErrorLog')
  21. },
  22. }
  23. export default { state, getters, mutations, actions }