1
0
Fork 0

Pagination query func is chainable now

This commit is contained in:
Joe Wroten 2017-05-10 16:39:14 -05:00
parent 513af3a56b
commit e0b37bbf33
2 changed files with 3 additions and 1 deletions

View file

@ -64,6 +64,7 @@ export default {
pagedSpells () {
return new Query(this.sortedSpells)
.paginate(this.page, this.perPage)
.results
},
sortedSpells () {
return this.spells

View file

@ -34,6 +34,7 @@ export default class Query {
paginate (page = 1, perPage = 10) {
let min = page * perPage - perPage
let max = min + perPage
return this.data.slice(min, max)
this.data = this.data.slice(min, max)
return this
}
}