diff --git a/src/hoc/withPasswordProtect.tsx b/src/hoc/withPasswordProtect.tsx index 113f3c8..98db01d 100644 --- a/src/hoc/withPasswordProtect.tsx +++ b/src/hoc/withPasswordProtect.tsx @@ -1,4 +1,5 @@ import React, { ElementType, useEffect, useState } from 'react'; +import { NextPageContext } from 'next'; import { useAmp } from 'next/amp'; import type { AppProps } from 'next/app'; @@ -74,6 +75,13 @@ export const withPasswordProtect = ( /> ); }; + ProtectedApp.getInitialProps = async (ctx: NextPageContext) => { + if (App.getInitialProps) { + return App.getInitialProps(ctx); + } + + return {}; + }; return ProtectedApp; };