import { useSession, signOut } from 'next-auth/react'


export default function User() {
  const { data, status } = useSession();

  if (status === 'loading' || !data?.user?.email) {
    return null;
  }

  return (
    <>
      <div className="font-extrabold bg-red-400 px-2 py-1 mr-3 rounded-sm">
        {data.user.email}
      </div>
      <button onClick={() => signOut()} className="btn btn-blue">
        Logout
      </button>
    </>
  )
}
