mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-01-30 17:15:16 +01:00
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()
|
||||
.then(() => {
|
||||
loading.close()
|
||||
this.$store.commit('GlobalHeader/updateChanging', false)
|
||||
})
|
||||
.catch(() => {
|
||||
loading.close()
|
||||
this.$store.commit('GlobalHeader/updateChanging', false)
|
||||
})
|
||||
},
|
||||
beforeDestroy () {
|
||||
|
@ -5,7 +5,8 @@ const GlobalHeader = {
|
||||
namespaced: true,
|
||||
state: {
|
||||
defaultActive: '0',
|
||||
accounts: []
|
||||
accounts: [],
|
||||
changing: false
|
||||
},
|
||||
mutations: {
|
||||
changeDefaultActive (state, index) {
|
||||
@ -13,6 +14,9 @@ const GlobalHeader = {
|
||||
},
|
||||
updateAccounts (state, accounts) {
|
||||
state.accounts = accounts
|
||||
},
|
||||
updateChanging (state, value) {
|
||||
state.changing = value
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@ -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`)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user