added wrapper to getInitialProps to prevent api calls in production

This commit is contained in:
tmshv committed 2019-10-13 19:48:52 +03:00
1 parent dded475c47
commit fe5cc36182
12 files changed
+49 -33

No files matched your search

+3 -3
View File
@@ -6,7 +6,7 @@ import menuModel from '../../src/models/menu'
import { buildMenu } from '../../src/lib/menu'
import { meta } from '../../src/lib/meta'
import { Meta } from '../../src/components/Meta'
import { createApiUrl, requestGet } from '../../src/next-lib'
import { createApiUrl, requestGet, wrapInitialProps } from '../../src/next-lib'
const Page = (props) => (
<App
@@ -28,7 +28,7 @@ const Page = (props) => (
</App>
)
Page.getInitialProps = async (ctx) => {
Page.getInitialProps = wrapInitialProps(async (ctx) => {
const pageUrl = '/'
const page = parseInt(ctx.query.page)
const pageSize = parseInt(ctx.query.pageSize) || 15
@@ -48,6 +48,6 @@ Page.getInitialProps = async (ctx) => {
title,
})
}
}
})
export default Page