25 lines
608 B
TypeScript
25 lines
608 B
TypeScript
import "@/styles/globals.css";
|
|
import type { AppContext, AppProps } from "next/app";
|
|
import App from "next/app";
|
|
import Div100vh from "react-div-100vh";
|
|
|
|
export default function MyApp({ Component, pageProps }: AppProps) {
|
|
return (
|
|
<Div100vh>
|
|
<Component {...pageProps} />
|
|
</Div100vh>
|
|
);
|
|
}
|
|
|
|
MyApp.getInitialProps = async (appContext: AppContext) => {
|
|
const appProps = await App.getInitialProps(appContext);
|
|
|
|
if (appContext.ctx.res?.statusCode === 404) {
|
|
appContext.ctx.res.writeHead(302, { Location: "/" });
|
|
appContext.ctx.res.end();
|
|
return;
|
|
}
|
|
|
|
return { ...appProps };
|
|
};
|