Skip to content

Commit

Permalink
Merge pull request #245 from h3poteto/iss-244
Browse files Browse the repository at this point in the history
closes #244 Block changing account when loading timeline
  • Loading branch information
h3poteto authored Apr 19, 2018
2 parents e0c4953 + 8c23fa6 commit 8ea31ee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/renderer/components/TimelineSpace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ export default {
this.initialize()
.then(() => {
loading.close()
this.$store.commit('GlobalHeader/updateChanging', false)
})
.catch(() => {
loading.close()
this.$store.commit('GlobalHeader/updateChanging', false)
})
},
beforeDestroy () {
Expand Down
13 changes: 11 additions & 2 deletions src/renderer/store/GlobalHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ const GlobalHeader = {
namespaced: true,
state: {
defaultActive: '0',
accounts: []
accounts: [],
changing: false
},
mutations: {
changeDefaultActive (state, index) {
state.defaultActive = index
},
updateAccounts (state, accounts) {
state.accounts = accounts
},
updateChanging (state, value) {
state.changing = value
}
},
actions: {
Expand All @@ -30,8 +34,13 @@ const GlobalHeader = {
})
})
},
watchShortcutEvents ({ commit }) {
watchShortcutEvents ({ state, commit }) {
ipcRenderer.on('change-account', (event, account) => {
if (state.changing) {
return null
}
// changing finish after loading
commit('updateChanging', true)
commit('changeDefaultActive', account.index.toString())
router.push(`/${account._id}/home`)
})
Expand Down

0 comments on commit 8ea31ee

Please sign in to comment.