You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
boundary/website/components/auth-indicator/index.jsx

28 lines
760 B

import { signOut, useSession } from 'next-auth/client'
import styles from './auth-indicator.module.css'
import Button from '@hashicorp/react-button'
export default function AuthIndicator() {
const [session, loading] = useSession()
if (loading) return `Loading...`
return (
<div className={styles.authIndicator}>
{session && (
<>
<span className={`g-type-label ${styles.loggedInText}`}>
Signed in as {session.user.email}
</span>
<span>
<Button
onClick={signOut}
title={`Sign out`}
size="small"
theme={{ variant: 'secondary-neutral', background: 'dark' }}
/>
</span>
</>
)}
</div>
)
}