kopia lustrzana https://github.com/Tldraw/Tldraw
Update auth-test.tsx
rodzic
519ba182d6
commit
9de38aa9da
|
@ -2,8 +2,8 @@ import Head from 'next/head'
|
|||
import { signIn, signOut, getSession, useSession } from 'next-auth/client'
|
||||
import { GetServerSidePropsContext } from 'next'
|
||||
|
||||
export default function Home({ session }: any) {
|
||||
// const [session, loading] = useSession()
|
||||
export default function Home() {
|
||||
const [session, loading] = useSession()
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
|
@ -13,23 +13,9 @@ export default function Home({ session }: any) {
|
|||
<button onClick={() => signIn()}>Sign In</button>
|
||||
<button onClick={() => signOut()}>Sign Out</button>
|
||||
<pre>{JSON.stringify(session, null, 2)}</pre>
|
||||
{loading && 'Loading...'}
|
||||
{session && <p>Hey, you made it! Thanks for sponsoring me.</p>}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
const session = await getSession(context)
|
||||
.then((c) => {
|
||||
console.log(c)
|
||||
return c
|
||||
})
|
||||
.catch((e) => console.log(e))
|
||||
|
||||
return {
|
||||
props: {
|
||||
session,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue