move Layout into _app.tsx

This commit is contained in:
Thomas Ruoff
2022-09-09 00:17:47 +02:00
committed by Thomas Ruoff
parent 7389289b81
commit 2fd3a47e72
12 changed files with 112 additions and 132 deletions

View File

@@ -1,7 +1,11 @@
export { reportWebVitals } from 'next-axiom'
import { useEffect } from 'react'
import type { AppProps } from 'next/app'
import { useSession, signIn, SessionProvider } from 'next-auth/react'
import Layout from '../components/layout';
import '../styles/index.css'
function Auth({ children }) {
@@ -29,13 +33,15 @@ export default function MyApp({
return (
<div className="flex flex-col min-h-screen">
<SessionProvider session={session}>
{Component.authenticationRequired ? (
<Auth>
<Layout>
{Component.authenticationRequired ? (
<Auth>
<Component {...pageProps} />
</Auth>
) : (
<Component {...pageProps} />
</Auth>
) : (
<Component {...pageProps} />
)}
)}
</Layout>
</SessionProvider>
</div>
)