diff --git a/web/src/store/index.js b/web/src/store/index.js index 58a8e08..5b35fa8 100644 --- a/web/src/store/index.js +++ b/web/src/store/index.js @@ -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) + } } })