home page size query
This commit is contained in:
1 parent
07cd42abc1
commit
e366830677
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -32,7 +32,7 @@ module.exports = withCss(withSass({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
// ...defaultPathMap,
|
// ...defaultPathMap,
|
||||||
'/': { page: '/' },
|
'/': { page: '/', query: { pageSize: articlesPageSize } },
|
||||||
'/documents': { page: '/documents' },
|
'/documents': { page: '/documents' },
|
||||||
'/gallery': { page: '/gallery' },
|
'/gallery': { page: '/gallery' },
|
||||||
'/collective': { page: '/collective' },
|
'/collective': { page: '/collective' },
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ const Page = (props) => (
|
|||||||
Page.getInitialProps = async (ctx) => {
|
Page.getInitialProps = async (ctx) => {
|
||||||
const pageUrl = ctx.req.url
|
const pageUrl = ctx.req.url
|
||||||
const page = 1
|
const page = 1
|
||||||
const pageSize = 10
|
const pageSize = ctx.query.pageSize
|
||||||
const apiUrl = `http://localhost:3000/api/articles?page=${page}&pageSize=${pageSize}`
|
const apiUrl = `http://localhost:3000/api/articles?page=${page}&pageSize=${pageSize}`
|
||||||
const res = await axios.get(apiUrl)
|
const res = await axios.get(apiUrl)
|
||||||
const articles = res.data.items
|
const articles = res.data.items
|
||||||
|
|||||||
Reference in new issue
Block a user