wrapInitialProps typing
This commit is contained in:
1 parent
0fab398ca6
commit
05e55d2668
1 file changed
+3
-2
+3
-2
@@ -1,4 +1,5 @@
|
||||
import axios from 'axios'
|
||||
import { NextPageContext } from 'next'
|
||||
|
||||
export interface IResponseItems<T> {
|
||||
items: T[]
|
||||
@@ -20,8 +21,8 @@ export async function requestGet<T>(url: string, defaultResponse: T): Promise<T>
|
||||
*
|
||||
* @param {*} fn
|
||||
*/
|
||||
export function wrapInitialProps(fn) {
|
||||
return async ctx => {
|
||||
export function wrapInitialProps(fn: (ctx: NextPageContext) => void) {
|
||||
return async (ctx: NextPageContext) => {
|
||||
if (process.env.NODE_ENV === 'production' && process.browser) {
|
||||
return window['__NEXT_DATA__'].props.pageProps;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user