1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-01-11 16:35:09 +01:00

refs #7 Add loading when get accounts list

This commit is contained in:
AkiraFukushima 2018-03-13 23:32:26 +09:00
parent 29d37d6489
commit 375dfab154

View File

@ -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' })
})
},