Skip to content

Commit

Permalink
refs #447 Fix account switching in global header menu
Browse files Browse the repository at this point in the history
  • Loading branch information
h3poteto committed Jul 30, 2018
1 parent 12b19f4 commit e4759b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/renderer/components/GlobalHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/store/GlobalHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit e4759b7

Please sign in to comment.