Enable vuex logging

This commit is contained in:
Jan Bader 2022-01-29 22:39:13 +00:00
parent e85cf0ea55
commit 6f7aa28d22

View File

@ -1,4 +1,4 @@
import { createStore } from 'vuex'
import { createStore, createLogger } from 'vuex'
import dashboard from './modules/dashboard'
import { LOGIN, LOGIN_SUCCESS, LOGOUT, TITLE } from './mutation-types'
@ -80,17 +80,18 @@ const store = createStore({
},
modules: {
dashboard
}
},
plugins: [createLogger()]
})
store.subscribe((mutation, state) => {
switch(mutation.type){
case "setCurrentBudget":
store.dispatch("fetchBudget", mutation.payload.ID)
break;
case "setCurrentAccount":
store.dispatch("fetchAccount", mutation.payload.ID)
break;
store.subscribeAction({
after(mutation, state) {
switch(mutation.type){
case "setCurrentBudget":
return store.dispatch("fetchBudget", mutation.payload)
case "setCurrentAccount":
return store.dispatch("fetchAccount", mutation.payload)
}
}
})