From c580f0db22e2cae5aa84e3b7bf2e945fa5ed7688 Mon Sep 17 00:00:00 2001 From: Jabed Zaman Date: Sun, 26 Mar 2023 01:45:38 +0530 Subject: [PATCH] docs: fix `session.user` is possibly `undefined`. (#7058) fixed the code snippet for the example to consume session via hooks. Threw an error earlier stating 'session.user' is possibly 'undefined'. --- docs/docs/getting-started/oauth-tutorial.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/getting-started/oauth-tutorial.mdx b/docs/docs/getting-started/oauth-tutorial.mdx index 7b081a934f..0bbb325108 100644 --- a/docs/docs/getting-started/oauth-tutorial.mdx +++ b/docs/docs/getting-started/oauth-tutorial.mdx @@ -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

Hang on there...