Skip to content

Commit

Permalink
docs: fix session.user is possibly undefined. (#7058)
Browse files Browse the repository at this point in the history
fixed the code snippet for the example to consume session via hooks. Threw an error earlier stating 'session.user' is possibly 'undefined'.
  • Loading branch information
jabedzaman committed Mar 25, 2023
1 parent d1cf701 commit c580f0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/docs/getting-started/oauth-tutorial.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ import { useSession, signIn, signOut } from "next-auth/react"

export default function CamperVanPage() {
const { data: session, status } = useSession()
const userEmail = session?.user.email
const userEmail = session?.user?.email

if (status === "loading") {
return <p>Hang on there...</p>
Expand Down

1 comment on commit c580f0d

@vercel
Copy link

@vercel vercel bot commented on c580f0d Mar 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.