1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-01-27 07:46:15 +01:00

Merge pull request #47 from h3poteto/iss-7

closes #7 Add loading when load home timeline
This commit is contained in:
AkiraFukushima 2018-03-13 23:33:24 +09:00 committed by GitHub
commit bdbf4885cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

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

View File

@ -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'