Files
reflector/www/app/(auth)/userInfo.tsx
2023-09-15 12:39:51 +02:00

27 lines
645 B
TypeScript

"use client";
import {
useFiefIsAuthenticated,
useFiefUserinfo,
} from "@fief/fief/nextjs/react";
import Link from "next/link";
import Image from "next/image";
export default function UserInfo() {
const isAuthenticated = useFiefIsAuthenticated();
const userinfo = useFiefUserinfo();
return !isAuthenticated ? (
<span className="hover:underline font-thin px-2">
<Link href="/login">Log in or create account</Link>
</span>
) : (
<span className="font-thin px-2">
{userinfo?.email} (
<span className="hover:underline">
<Link href="/logout">Log out</Link>
</span>
)
</span>
);
}