Skip to content

Commit

Permalink
fix: #7468
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Mar 19, 2019
1 parent c326141 commit b4a9bb1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ pagination.create = function (currentPage, pageCount, queryObj) {
return {
prev: { page: 1, active: currentPage > 1 },
next: { page: 1, active: currentPage < pageCount },
first: { page: 1, active: currentPage === 1 },
last: { page: 1, active: currentPage === pageCount },
rel: [],
pages: [],
currentPage: 1,
Expand Down Expand Up @@ -59,6 +61,11 @@ pagination.create = function (currentPage, pageCount, queryObj) {
queryObj.page = next;
data.next = { page: next, active: currentPage < pageCount, qs: qs.stringify(queryObj) };

queryObj.page = 1;
data.first = { page: 1, active: currentPage === 1, qs: qs.stringify(queryObj) };
queryObj.page = pageCount;
data.last = { page: pageCount, active: currentPage === pageCount, qs: qs.stringify(queryObj) };

if (currentPage < pageCount) {
data.rel.push({
rel: 'next',
Expand Down

0 comments on commit b4a9bb1

Please sign in to comment.