errorLog.js 406 B

12345678910111213141516171819202122232425262728
  1. const state = {
  2. logs: []
  3. }
  4. const mutations = {
  5. ADD_ERROR_LOG: (state, log) => {
  6. state.logs.push(log)
  7. },
  8. CLEAR_ERROR_LOG: (state) => {
  9. state.logs.splice(0)
  10. }
  11. }
  12. const actions = {
  13. addErrorLog({ commit }, log) {
  14. commit('ADD_ERROR_LOG', log)
  15. },
  16. clearErrorLog({ commit }) {
  17. commit('CLEAR_ERROR_LOG')
  18. }
  19. }
  20. export default {
  21. namespaced: true,
  22. state,
  23. mutations,
  24. actions
  25. }