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