refactor[errorLog]: save the logs in vuex
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
const errLog = {
|
||||
state: {
|
||||
errLog: []
|
||||
},
|
||||
pushLog(log) {
|
||||
this.state.errLog.unshift(log)
|
||||
},
|
||||
clearLog() {
|
||||
this.state.errLog = []
|
||||
}
|
||||
}
|
||||
|
||||
export default errLog
|
@@ -11,6 +11,7 @@ const getters = {
|
||||
roles: state => state.user.roles,
|
||||
setting: state => state.user.setting,
|
||||
permission_routers: state => state.permission.routers,
|
||||
addRouters: state => state.permission.addRouters
|
||||
addRouters: state => state.permission.addRouters,
|
||||
errorLogs: state => state.errorLog.logs
|
||||
}
|
||||
export default getters
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import app from './modules/app'
|
||||
import errorLog from './modules/errorLog'
|
||||
import permission from './modules/permission'
|
||||
import tagsView from './modules/tagsView'
|
||||
import user from './modules/user'
|
||||
@@ -11,6 +12,7 @@ Vue.use(Vuex)
|
||||
const store = new Vuex.Store({
|
||||
modules: {
|
||||
app,
|
||||
errorLog,
|
||||
permission,
|
||||
tagsView,
|
||||
user
|
||||
|
17
src/store/modules/errorLog.js
Normal file
17
src/store/modules/errorLog.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const errorLog = {
|
||||
state: {
|
||||
logs: []
|
||||
},
|
||||
mutations: {
|
||||
ADD_ERROR_LOG: (state, log) => {
|
||||
state.logs.push(log)
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
addErrorLog({ commit }, log) {
|
||||
commit('ADD_ERROR_LOG', log)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default errorLog
|
Reference in New Issue
Block a user