mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-14 07:13:08 +02:00
Fix bug
This commit is contained in:
parent
9bfbc12afa
commit
cfb35324d0
1 changed files with 8 additions and 1 deletions
|
@ -5,6 +5,7 @@ export default (opts) => ({
|
||||||
return {
|
return {
|
||||||
items: [],
|
items: [],
|
||||||
queue: [],
|
queue: [],
|
||||||
|
offset: 0,
|
||||||
fetching: true,
|
fetching: true,
|
||||||
moreFetching: false,
|
moreFetching: false,
|
||||||
inited: false,
|
inited: false,
|
||||||
|
@ -80,6 +81,7 @@ export default (opts) => ({
|
||||||
this.items = x;
|
this.items = x;
|
||||||
this.more = false;
|
this.more = false;
|
||||||
}
|
}
|
||||||
|
this.offset = x.length;
|
||||||
this.inited = true;
|
this.inited = true;
|
||||||
this.fetching = false;
|
this.fetching = false;
|
||||||
if (opts.onInited) opts.onInited(this);
|
if (opts.onInited) opts.onInited(this);
|
||||||
|
@ -96,7 +98,11 @@ export default (opts) => ({
|
||||||
if (params && params.then) params = await params;
|
if (params && params.then) params = await params;
|
||||||
await this.$root.api(this.pagination.endpoint, {
|
await this.$root.api(this.pagination.endpoint, {
|
||||||
limit: (this.pagination.limit || 10) + 1,
|
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
|
...params
|
||||||
}).then(x => {
|
}).then(x => {
|
||||||
if (x.length == (this.pagination.limit || 10) + 1) {
|
if (x.length == (this.pagination.limit || 10) + 1) {
|
||||||
|
@ -107,6 +113,7 @@ export default (opts) => ({
|
||||||
this.items = this.items.concat(x);
|
this.items = this.items.concat(x);
|
||||||
this.more = false;
|
this.more = false;
|
||||||
}
|
}
|
||||||
|
this.offset += x.length;
|
||||||
this.moreFetching = false;
|
this.moreFetching = false;
|
||||||
}, e => {
|
}, e => {
|
||||||
this.moreFetching = false;
|
this.moreFetching = false;
|
||||||
|
|
Loading…
Reference in a new issue