Added base path

This commit is contained in:
Sebastian Seedorf
2022-08-18 13:33:50 +02:00
parent 19e67a5f84
commit 07469dde88
6 changed files with 23 additions and 25 deletions

View File

@@ -1,9 +1,17 @@
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import { FC } from 'react'
import Head from 'next/head'
import {useRouter} from 'next/router'
const MyApp: FC<AppProps> = ({ Component, pageProps }) => {
return <Component {...pageProps} />
const router = useRouter()
return <>
<Head>
<link rel='icon' href={`${router.basePath}/favicon.ico`} />
</Head>
<Component {...pageProps} />
</>
}
export default MyApp

View File

@@ -1,18 +0,0 @@
import { Html, Main, NextScript, DocumentProps, Head } from 'next/document'
import { FC } from 'react'
import Dict = NodeJS.Dict
const MyDocument: FC<DocumentProps> = ({ __NEXT_DATA__ }) => {
const pageProps: Dict<unknown> | undefined = __NEXT_DATA__?.props?.pageProps
return (
<Html>
<Head />
<body className={pageProps?.bodyClassName as string}>
<Main />
<NextScript />
</body>
</Html>
)
}
export default MyDocument

View File

@@ -10,7 +10,6 @@ const Page: NextPage<PropsGroupProvider> = ({ id, ...initial }) => {
<Head>
<title>Factorio Microservices</title>
<meta name='description' content='Create Factorio microservices' />
<link rel='icon' href='/favicon.ico' />
</Head>
<Home />
</GroupProvider>