diff --git a/src/renderer/components/TimelineSpace.vue b/src/renderer/components/TimelineSpace.vue index 1dc14f0f..7578c103 100644 --- a/src/renderer/components/TimelineSpace.vue +++ b/src/renderer/components/TimelineSpace.vue @@ -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 () { diff --git a/src/renderer/store/GlobalHeader.js b/src/renderer/store/GlobalHeader.js index 87fedb82..3e7dec2f 100644 --- a/src/renderer/store/GlobalHeader.js +++ b/src/renderer/store/GlobalHeader.js @@ -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`) })