articles page pageSize from query
This commit is contained in:
1 parent
56a6735bfd
commit
27722ae87c
1 file changed
+1
-1
@@ -34,7 +34,7 @@ const Page = (props) => (
|
|||||||
Page.getInitialProps = async (ctx) => {
|
Page.getInitialProps = async (ctx) => {
|
||||||
const pageUrl = '/'
|
const pageUrl = '/'
|
||||||
const page = parseInt(ctx.query.page)
|
const page = parseInt(ctx.query.page)
|
||||||
const pageSize = 10
|
const pageSize = parseInt(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