more work on auth

This commit is contained in:
Thomas Ruoff
2024-09-12 23:25:34 +02:00
parent 9f80ca4b1b
commit 219881810d
4 changed files with 45 additions and 35 deletions

View File

@@ -1,16 +1,14 @@
import { SessionProvider } from 'next-auth/react'
import Auth from '../components/auth'
import User from '../components/user'
// This is the HOC
function withAuth(WrappedComponent) {
function withAuth(WrappedComponent: React.FunctionComponent) {
// Return a new component
function withAuth({ session, ...pageProps }) {
// Render the WrappedComponent with additional props
return (
<SessionProvider session={session}>
<Auth>
<User />
<WrappedComponent {...pageProps} />
</Auth>
</SessionProvider>