diff --git a/src/pages/Index.vue b/src/pages/Index.vue
index d3986ae..a1e23f8 100644
--- a/src/pages/Index.vue
+++ b/src/pages/Index.vue
@@ -37,7 +37,9 @@
-
+
+
+
@@ -113,24 +115,22 @@
this.loadedPosts.push(...this.$page.posts.edges)
this.infiniteLoadingActivated = false
},
+ mounted() {
+ this.infiniteLoadingActivated = true
+ },
methods: {
async infiniteHandler($state) {
- console.log('Fetching infinite.')
- this.infiniteLoadingActivated = true
if (this.currentPage + 1 > this.$page.posts.pageInfo.totalPages) {
- console.log('State complete.')
$state.complete()
} else {
const { data } = await this.$fetch(
`/${this.currentPage + 1}`
)
if (data.posts.edges.length) {
- console.log('Pushing next posts')
this.currentPage = data.posts.pageInfo.currentPage
this.loadedPosts.push(...data.posts.edges)
$state.loaded()
} else {
- console.log('Bad data: state complete')
$state.complete()
}
}