diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-06-13 18:15:35 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-06-13 18:15:35 +0900 |
| commit | cfb35324d008ad7dd7303909cb387b1a67e52340 (patch) | |
| tree | e3f15a77b9cfece031dfdc4117951b6d9e2d3a58 /src | |
| parent | Add indexes (diff) | |
| download | sharkey-cfb35324d008ad7dd7303909cb387b1a67e52340.tar.gz sharkey-cfb35324d008ad7dd7303909cb387b1a67e52340.tar.bz2 sharkey-cfb35324d008ad7dd7303909cb387b1a67e52340.zip | |
Fix bug
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/app/common/scripts/paging.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/client/app/common/scripts/paging.ts b/src/client/app/common/scripts/paging.ts index c13a607e6f..cf36a692d2 100644 --- a/src/client/app/common/scripts/paging.ts +++ b/src/client/app/common/scripts/paging.ts @@ -5,6 +5,7 @@ export default (opts) => ({ return { items: [], queue: [], + offset: 0, fetching: true, moreFetching: false, inited: false, @@ -80,6 +81,7 @@ export default (opts) => ({ this.items = x; this.more = false; } + this.offset = x.length; this.inited = true; this.fetching = false; if (opts.onInited) opts.onInited(this); @@ -96,7 +98,11 @@ export default (opts) => ({ if (params && params.then) params = await params; await this.$root.api(this.pagination.endpoint, { limit: (this.pagination.limit || 10) + 1, - untilId: this.items[this.items.length - 1].id, + ...(this.pagination.endpoint === 'notes/search' ? { + offset: this.offset, + } : { + untilId: this.items[this.items.length - 1].id, + }), ...params }).then(x => { if (x.length == (this.pagination.limit || 10) + 1) { @@ -107,6 +113,7 @@ export default (opts) => ({ this.items = this.items.concat(x); this.more = false; } + this.offset += x.length; this.moreFetching = false; }, e => { this.moreFetching = false; |