|
|
@@ -207,24 +207,26 @@ export default {
|
|
|
|
|
|
return filter
|
|
|
},
|
|
|
- async loadMoreContents(index, done) {
|
|
|
+ loadMoreContents(index, done) {
|
|
|
if (this.contents.loading) return
|
|
|
this.contents.loading = true
|
|
|
- try {
|
|
|
- const { list, paginate } = await APIGateway.content.index({ ...this.filters, page: this.nextPage, per_page: this.perPage })
|
|
|
- this.nextPage = paginate.current + 1
|
|
|
- if (this.nextPage > paginate.num_pages) {
|
|
|
- done(true) // پایان لیست
|
|
|
- } else {
|
|
|
- done()
|
|
|
- }
|
|
|
- const newList = new ContentList(list)
|
|
|
- this.contents.list = [...this.contents.list, ...newList.list]
|
|
|
- } catch (error) {
|
|
|
- done(true) // در صورت خطا بارگذاری را متوقف کن
|
|
|
- } finally {
|
|
|
- this.contents.loading = false
|
|
|
- }
|
|
|
+ APIGateway.content.index({ ...this.filters, page: this.nextPage, per_page: this.perPage })
|
|
|
+ .then(({ list, paginate }) => {
|
|
|
+ this.nextPage = paginate.current + 1
|
|
|
+ if (this.nextPage > paginate.num_pages) {
|
|
|
+ done(true) // پایان لیست
|
|
|
+ } else {
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ const newList = new ContentList(list)
|
|
|
+ this.contents.list = [...this.contents.list, ...newList.list]
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ done(true) // در صورت خطا بارگذاری را متوقف کن
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.contents.loading = false
|
|
|
+ })
|
|
|
},
|
|
|
getContentCategories () {
|
|
|
const filter = this.getFilterOfCategorySearch()
|