Skip to content

Commit

Permalink
fix(app): fix pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
abedzantout committed Sep 23, 2019
1 parent 88d1f71 commit cf61fcb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
1 change: 1 addition & 0 deletions core/contentful.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class ContentfulService {
include: 1,
limit,
skip,
order: 'fields.publishDate',
'fields.tags.sys.id': tag,
content_type: CONTENT_TYPE_BLOGPOST
});
Expand Down
38 changes: 19 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
"@types/node": "~12.7.5",
"@types/react": "~16.9.2",
"@types/react-dom": "~16.9.0",
"@typescript-eslint/eslint-plugin": "~2.3.0",
"@typescript-eslint/parser": "~2.3.0",
"@typescript-eslint/eslint-plugin": "~2.3.1",
"@typescript-eslint/parser": "~2.3.1",
"all-contributors-cli": "^6.9.1",
"contentful-cli": "~1.1.0",
"contentful-migration": "~1.0.0",
"contentful-migration": "~1.0.1",
"eslint-config-prettier": "~6.3.0",
"prettier": "~1.18.2",
"pretty-quick": "~1.11.1",
Expand Down
4 changes: 2 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ IndexPage.getInitialProps = async ({query}) => {

const {entries, total, skip, limit} = await contentfulService.getBlogPostEntries({
tag: query.tag ? query.tag.toString() : '',
skip: page - 1,
limit: 2,
skip: (page - 1) * 3,
limit: 3,
});

// TODO: need to move outside
Expand Down

0 comments on commit cf61fcb

Please sign in to comment.