refs #447 Fix account switching in global header menu

This commit is contained in:
AkiraFukushima 2018-07-31 08:15:10 +09:00
parent 12b19f461b
commit e4759b7fd1
2 changed files with 7 additions and 2 deletions

View File

@ -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)
}
}
}

View File

@ -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'