Skip to content

Commit 46bcae2

Browse files
committed
fix: getInitialProps not being called in the App
#59
1 parent 95f6e1a commit 46bcae2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/hoc/withPasswordProtect.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { ElementType, useEffect, useState } from 'react';
2+
import { NextPageContext } from 'next';
23
import { useAmp } from 'next/amp';
34
import type { AppProps } from 'next/app';
45

@@ -74,6 +75,13 @@ export const withPasswordProtect = (
7475
/>
7576
);
7677
};
78+
ProtectedApp.getInitialProps = async (ctx: NextPageContext) => {
79+
if (App.getInitialProps) {
80+
return App.getInitialProps(ctx);
81+
}
82+
83+
return {};
84+
};
7785

7886
return ProtectedApp;
7987
};

0 commit comments

Comments
 (0)