Update auth-test.tsx
This commit is contained in:
parent
2a96a587e2
commit
9e36c24800
1 changed files with 3 additions and 4 deletions
|
@ -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,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue