From 37c3b2dda95a9940b751fa0e1e8d13746b402635 Mon Sep 17 00:00:00 2001 From: Troplo Date: Thu, 28 Jan 2021 20:21:17 +1100 Subject: [PATCH] Pagination page crash patch --- src/components/Pagination.vue | 4 ++-- src/views/Marketplace.vue | 9 ++++++++- src/views/Users.vue | 10 ++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/components/Pagination.vue b/src/components/Pagination.vue index 486e83e..59d8581 100644 --- a/src/components/Pagination.vue +++ b/src/components/Pagination.vue @@ -9,7 +9,7 @@ import throttle from 'lodash.throttle' export default { name: 'Pagination', - props: ['loading', 'query-selector', 'padding-bottom', 'padding-top', 'paginate'], + props: ['loading', 'query-selector', 'padding-bottom', 'padding-top', 'paginate', 'wait'], computed: { element () { if(this.querySelector){ @@ -48,7 +48,7 @@ export default { } if(scrollBottom > 0) { - if(this.paginate) { + if(this.paginate && !this.wait) { this.$emit('loadNext'); } } else if(scrollTop > 0) { diff --git a/src/views/Marketplace.vue b/src/views/Marketplace.vue index 3708213..53469b6 100644 --- a/src/views/Marketplace.vue +++ b/src/views/Marketplace.vue @@ -41,6 +41,7 @@ v-if='items.length' :loading='loading' :paginate="paginate" + :wait="wait" @loadNext='getItems(false)' >
@@ -153,7 +154,8 @@ export default { paginate: true, offset: 0, nextURL: null, - category: this.$route.params.category + category: this.$route.params.category, + wait: true } }, methods: { @@ -175,6 +177,9 @@ export default { }, getItems (initial) { this.loading = true + if(!initial) { + this.wait = true + } this.axios .get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'marketplace/' + this.category + '?offset=' + this.offset) .then(res => { @@ -194,9 +199,11 @@ export default { this.last = res.data.Items } this.loading = false + this.wait = false }) .catch((e) => { this.loading = false + this.wait = false AjaxErrorHandler(this.$store)(e) }) }, diff --git a/src/views/Users.vue b/src/views/Users.vue index d077453..2a37bfb 100644 --- a/src/views/Users.vue +++ b/src/views/Users.vue @@ -7,11 +7,11 @@
@@ -113,7 +113,8 @@ export default { offset: 0, paginate: true, limit: 30, - loading: true + loading: true, + wait: true } }, methods: { @@ -124,6 +125,9 @@ export default { this.offset = 0 this.paginate = true } + if(!initial) { + this.wait = true + } this.axios .get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'user/' + '?offset=' + this.offset) .then(res => { @@ -141,9 +145,11 @@ export default { this.users.push(...res.data) } this.loading = false + this.wait = false }) .catch((e) => { this.loading = false + this.wait = false AjaxErrorHandler(this.$store)(e) }) }