refs #244 Block changing account when loading timeline
This commit is contained in:
parent
e0c4953c2f
commit
8c23fa675f
|
@ -30,9 +30,11 @@ export default {
|
||||||
this.initialize()
|
this.initialize()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loading.close()
|
loading.close()
|
||||||
|
this.$store.commit('GlobalHeader/updateChanging', false)
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
loading.close()
|
loading.close()
|
||||||
|
this.$store.commit('GlobalHeader/updateChanging', false)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
|
|
|
@ -5,7 +5,8 @@ const GlobalHeader = {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
defaultActive: '0',
|
defaultActive: '0',
|
||||||
accounts: []
|
accounts: [],
|
||||||
|
changing: false
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
changeDefaultActive (state, index) {
|
changeDefaultActive (state, index) {
|
||||||
|
@ -13,6 +14,9 @@ const GlobalHeader = {
|
||||||
},
|
},
|
||||||
updateAccounts (state, accounts) {
|
updateAccounts (state, accounts) {
|
||||||
state.accounts = accounts
|
state.accounts = accounts
|
||||||
|
},
|
||||||
|
updateChanging (state, value) {
|
||||||
|
state.changing = value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -30,8 +34,13 @@ const GlobalHeader = {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
watchShortcutEvents ({ commit }) {
|
watchShortcutEvents ({ state, commit }) {
|
||||||
ipcRenderer.on('change-account', (event, account) => {
|
ipcRenderer.on('change-account', (event, account) => {
|
||||||
|
if (state.changing) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
// changing finish after loading
|
||||||
|
commit('updateChanging', true)
|
||||||
commit('changeDefaultActive', account.index.toString())
|
commit('changeDefaultActive', account.index.toString())
|
||||||
router.push(`/${account._id}/home`)
|
router.push(`/${account._id}/home`)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue