remove auth status if not logged in
This commit is contained in:
@@ -48,35 +48,24 @@ export default function AuthStatus() {
|
|||||||
: { isAuthenticated: auth.isAuthenticated, user: auth.user };
|
: { isAuthenticated: auth.isAuthenticated, user: auth.user };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
displayState.isAuthenticated && (
|
||||||
className={`${nunito.className} absolute top-4 right-4 flex items-center gap-2 rounded-lg bg-blue-950/80 px-3 py-2`}
|
<div
|
||||||
>
|
className={`${nunito.className} absolute top-4 right-4 flex items-center gap-2 rounded-lg bg-blue-950/80 px-3 py-2`}
|
||||||
{displayState.isAuthenticated ? (
|
>
|
||||||
<>
|
<div className="h-2 w-2 rounded-full bg-green-500"></div>
|
||||||
<div className="h-2 w-2 rounded-full bg-green-500"></div>
|
<span className="text-sm font-medium text-white">
|
||||||
<span className="text-sm font-medium text-white">
|
{displayState.user?.profile.name || "Authenticated"}
|
||||||
{displayState.user?.profile.name || "Authenticated"}
|
</span>
|
||||||
</span>
|
<button
|
||||||
<button
|
onClick={() => {
|
||||||
onClick={() => {
|
void auth.removeUser();
|
||||||
void auth.removeUser();
|
router.push("/");
|
||||||
router.push("/");
|
}}
|
||||||
}}
|
className="ml-1 rounded bg-gray-500/50 px-2 py-1 text-xs transition-colors hover:bg-red-500/30"
|
||||||
className="ml-1 rounded bg-gray-500/50 px-2 py-1 text-xs transition-colors hover:bg-red-500/30"
|
>
|
||||||
>
|
Uitloggen
|
||||||
Uitloggen
|
</button>
|
||||||
</button>
|
</div>
|
||||||
</>
|
)
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<button
|
|
||||||
onClick={() => void auth.signinRedirect()}
|
|
||||||
className="rounded px-1 py-2 text-xs"
|
|
||||||
>
|
|
||||||
<div className="h-2 w-2 rounded-full bg-red-500"></div>
|
|
||||||
</button>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user