From ed9e80f161f6c99228595bc9dab9897469de224c Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Sun, 10 Jan 2021 12:31:02 +0100 Subject: Add pagination --- components/Posts/PostList/parentMixin.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'components/Posts/PostList/parentMixin.js') diff --git a/components/Posts/PostList/parentMixin.js b/components/Posts/PostList/parentMixin.js index 801d51c..b9181e8 100644 --- a/components/Posts/PostList/parentMixin.js +++ b/components/Posts/PostList/parentMixin.js @@ -1,9 +1,10 @@ import { getPosts } from './index' export default { - async asyncData() { - return { - posts: await getPosts(), - } + async asyncData({ query }) { + let page = query.page || 1; + const data = await getPosts(page); + return data; }, + watchQuery: true } -- cgit 1.4.1