[Client] Better pagination

Fix #4628
Close #4629
This commit is contained in:
syuilo 2019-04-08 14:17:44 +09:00
parent 1c57e6f80a
commit 1e166490d9
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
24 changed files with 59 additions and 56 deletions

View file

@ -21,19 +21,19 @@ export default Vue.extend({
return {
makePromise: cursor => this.$root.api('notes/search', {
limit: limit + 1,
offset: cursor ? cursor : undefined,
untilId: cursor ? cursor : undefined,
query: this.q
}).then(notes => {
if (notes.length == limit + 1) {
notes.pop();
return {
notes: notes,
cursor: cursor ? cursor + limit : limit
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})