mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 15:07:13 +01:00
Replace next-auth with better-auth, adding magic link email login as the primary auth method and GitHub OAuth as an optional social provider. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
28 lines
631 B
TypeScript
28 lines
631 B
TypeScript
import { useSession, signOut } from '../lib/auth-client'
|
|
import Link from 'next/link'
|
|
|
|
export default function User() {
|
|
const { data: session, isPending } = useSession()
|
|
|
|
if (isPending || !session?.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">
|
|
{session.user.email}
|
|
</div>
|
|
<button onClick={() => signOut()} className="btn btn-blue">
|
|
Logout
|
|
</button>
|
|
</>
|
|
)
|
|
}
|