mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-02 22:17:11 +01:00
28 lines
621 B
TypeScript
28 lines
621 B
TypeScript
import { useSession, signOut } from 'next-auth/react'
|
|
import Link from 'next/link'
|
|
|
|
export default function User() {
|
|
const { data, status } = useSession()
|
|
|
|
if (status === 'loading' || !data?.user?.email) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Link
|
|
href="/admin"
|
|
className="text-base font-medium text-gray-500 hover:text-gray-900"
|
|
>
|
|
Admin
|
|
</Link>
|
|
<div className="font-extrabold bg-red-400 px-2 py-1 mr-3 rounded-xs">
|
|
{data.user.email}
|
|
</div>
|
|
<button onClick={() => signOut()} className="btn btn-blue">
|
|
Logout
|
|
</button>
|
|
</>
|
|
)
|
|
}
|