fix: Handle error when lazy loading in home
This commit is contained in:
parent
87801766f4
commit
09bd6f20ea
|
@ -41,6 +41,12 @@ export default {
|
|||
onScroll (event) {
|
||||
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('home').clientHeight - 10) && !this.lazyloading) {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Home/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: 'Could not fetch home timeline',
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,9 @@ const Home = {
|
|||
},
|
||||
actions: {
|
||||
lazyFetchTimeline ({ state, commit, rootState }, last) {
|
||||
if (last === undefined || last === null) {
|
||||
return null
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
if (state.lazyLoading) {
|
||||
return resolve()
|
||||
|
|
Loading…
Reference in New Issue