diff --git a/src/renderer/components/GlobalHeader.vue b/src/renderer/components/GlobalHeader.vue index b6eb66ed..f7b400cb 100644 --- a/src/renderer/components/GlobalHeader.vue +++ b/src/renderer/components/GlobalHeader.vue @@ -38,11 +38,19 @@ export default { }) }, created () { + const loading = this.$loading({ + lock: true, + text: 'Loading', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) this.$store.dispatch('GlobalHeader/listAccounts') .then((accounts) => { + loading.close() return this.$router.push({ path: `/${accounts[0]._id}/home` }) }) .catch(() => { + loading.close() return this.$router.push({ path: '/login' }) }) }, diff --git a/src/renderer/components/TimelineSpace.vue b/src/renderer/components/TimelineSpace.vue index 05c6e69b..ab97e7ed 100644 --- a/src/renderer/components/TimelineSpace.vue +++ b/src/renderer/components/TimelineSpace.vue @@ -16,10 +16,20 @@ export default { name: 'timeline-space', components: { SideMenu, NewTootModal }, created () { + const loading = this.$loading({ + lock: true, + text: 'Loading', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) this.$store.dispatch('TimelineSpace/fetchAccount', this.$route.params.id) .then((account) => { this.$store.dispatch('TimelineSpace/fetchHomeTimeline', account) + .then(() => { + loading.close() + }) .catch(() => { + loading.close() this.$message({ message: 'Could not fetch timeline', type: 'error' @@ -49,6 +59,7 @@ export default { this.$store.dispatch('TimelineSpace/watchShortcutEvents', account) }) .catch(() => { + loading.close() this.$message({ message: 'Could not find account', type: 'error'