Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save skolhustick/d9cc49b0e98356d49429518c5cd6f928 to your computer and use it in GitHub Desktop.
Save skolhustick/d9cc49b0e98356d49429518c5cd6f928 to your computer and use it in GitHub Desktop.
import { signOut, useSession } from 'next-auth/react'
import Link from 'next/link'
import React from 'react'
const Homepage = () => {
const { data: session, status } = useSession()
if (status === 'loading') {
return <>Loading...</>
}
if (status === 'authenticated') {
return (
<>
Signed in as {session.user.email} <br />
<button onClick={() => signOut()}>Sign out</button>
</>
)
}
if (status === 'unauthenticated') {
return (
<>
Not signed in <br />
<Link href='/api/auth/signin'>
<a>Login</a>
</Link>
</>
)
}
}
export default Homepage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment