diff --git a/src/renderer/components/GlobalHeader.vue b/src/renderer/components/GlobalHeader.vue index fd2f4b5b11..15bfcd6b50 100644 --- a/src/renderer/components/GlobalHeader.vue +++ b/src/renderer/components/GlobalHeader.vue @@ -59,8 +59,7 @@ export default { return this.$router.push({ path: '/login' }) }, select (account) { - console.log(account._id) - return this.$router.push({ path: `/${account._id}/home` }) + return this.$store.dispatch('GlobalHeader/selectAccount', account) } } } diff --git a/src/renderer/store/GlobalHeader.js b/src/renderer/store/GlobalHeader.js index aa5c4f015c..71b398386b 100644 --- a/src/renderer/store/GlobalHeader.js +++ b/src/renderer/store/GlobalHeader.js @@ -64,6 +64,12 @@ const GlobalHeader = { router.push(`/${account._id}/home`) }) }, + selectAccount ({ state, commit }, account) { + commit('updateChanging', true) + const index = state.accounts.findIndex(a => a._id === account._id) + commit('changeDefaultActive', index.toString()) + router.push({ path: `/${account._id}/home` }) + }, async removeShortcutEvents () { ipcRenderer.removeAllListeners('change-account') return 'removeShortcutEvents'