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:
commit
bdbf4885cf
@ -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' })
|
||||
})
|
||||
},
|
||||
|
@ -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'
|
||||
|
Loading…
x
Reference in New Issue
Block a user