Update auth-test.tsx

This commit is contained in:
Steve Ruiz 2021-06-20 08:43:45 +01:00
parent 2a96a587e2
commit 9e36c24800

View file

@ -2,8 +2,8 @@ import Head from 'next/head'
import { signIn, signOut, getSession, useSession } from 'next-auth/client' import { signIn, signOut, getSession, useSession } from 'next-auth/client'
import { GetServerSidePropsContext } from 'next' import { GetServerSidePropsContext } from 'next'
export default function Home() { export default function Home({ session }: any) {
const [session, loading] = useSession() // const [session, loading] = useSession()
return ( return (
<> <>
<Head> <Head>
@ -12,7 +12,6 @@ export default function Home() {
<div> <div>
<button onClick={() => signIn()}>Sign In</button> <button onClick={() => signIn()}>Sign In</button>
<button onClick={() => signOut()}>Sign Out</button> <button onClick={() => signOut()}>Sign Out</button>
<p>{loading && 'Loading...'}</p>
<pre>{JSON.stringify(session, null, 2)}</pre> <pre>{JSON.stringify(session, null, 2)}</pre>
{session && <p>Hey, you made it! Thanks for sponsoring me.</p>} {session && <p>Hey, you made it! Thanks for sponsoring me.</p>}
</div> </div>
@ -25,7 +24,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
return { return {
props: { props: {
ssrSession: session, session,
}, },
} }
} }