From 375dfab154b1e936313373d75a6d97b3fa3ff50c Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Tue, 13 Mar 2018 23:32:26 +0900 Subject: [PATCH] refs #7 Add loading when get accounts list --- src/renderer/components/GlobalHeader.vue | 8 ++++++++ 1 file changed, 8 insertions(+) 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' }) }) },