From cf9181919a885f0ca40fc2dfb8bbbc456489e53e Mon Sep 17 00:00:00 2001 From: Sean Norwood Date: Sun, 3 Apr 2022 00:27:33 +0000 Subject: [PATCH] chore: initial suspense setup --- tubearchivist/www/src/pages/index.tsx | 30 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/tubearchivist/www/src/pages/index.tsx b/tubearchivist/www/src/pages/index.tsx index f9e3f84..2a6381b 100644 --- a/tubearchivist/www/src/pages/index.tsx +++ b/tubearchivist/www/src/pages/index.tsx @@ -1,9 +1,28 @@ import type { NextPage } from "next"; import { signIn, signOut, useSession } from "next-auth/react"; +import dynamic from "next/dynamic"; import Head from "next/head"; +import { Suspense } from "react"; + +const DynamicHeader = dynamic(() => import("../components/Header"), { + suspense: true, +}); + +const SignInOutButton = ({ isSignedIn }: { isSignedIn: boolean }) => { + if (isSignedIn) { + return ; + } + return ; +}; const Home: NextPage = () => { const { data: session, status } = useSession(); + const authData = { + session, + status, + }; + + console.log(status); return ( <> @@ -13,12 +32,10 @@ const Home: NextPage = () => { - {console.log("Session", session)} + Loading}> + + -

Name: {session?.user?.name}

-

Status: {status}

-

Token: {session?.ta_token?.token}

-

User ID: {session?.ta_token?.user_id}

{ maxWidth: "100px", }} > - - +
);