import Link from "next/link" import { signIn, signOut, useSession } from "next-auth/react" import styles from "../styles/header.module.css" // The approach used in this component shows how to build a sign in and sign out // component that works on pages which support both client and server side // rendering, and avoids any flash incorrect content on initial page load. export default function Header() { const { data: session, status } = useSession() const loading = status === "loading" //generate top header with sign in/out button and dropdown menu and user name/surname using tailwindcss return (
{/* */}

{!session && ( <> You are not signed in { e.preventDefault() signIn() }} > Sign in )} {session?.user && ( <> {session.user.image && ( )} Signed in as
{session.user.email ?? session.user.name}
{ e.preventDefault() signOut() }} > Sign out )}

) }