From e366830677b96b2f737c96fff53d1059d5675de5 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Fri, 2 Aug 2019 15:58:30 +0300 Subject: [PATCH] home page size query --- next.config.js | 2 +- pages/index.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/next.config.js b/next.config.js index 62c4c0af..3d4e7132 100644 --- a/next.config.js +++ b/next.config.js @@ -32,7 +32,7 @@ module.exports = withCss(withSass({ return { // ...defaultPathMap, - '/': { page: '/' }, + '/': { page: '/', query: { pageSize: articlesPageSize } }, '/documents': { page: '/documents' }, '/gallery': { page: '/gallery' }, '/collective': { page: '/collective' }, diff --git a/pages/index.jsx b/pages/index.jsx index 6f1076be..6de5c992 100644 --- a/pages/index.jsx +++ b/pages/index.jsx @@ -32,7 +32,7 @@ const Page = (props) => ( Page.getInitialProps = async (ctx) => { const pageUrl = ctx.req.url const page = 1 - const pageSize = 10 + const pageSize = ctx.query.pageSize const apiUrl = `http://localhost:3000/api/articles?page=${page}&pageSize=${pageSize}` const res = await axios.get(apiUrl) const articles = res.data.items