website/routes/profil/index.tsx

34 lines
726 B
TypeScript

import LoginForm from ':islands/LoginForm.tsx'
import PassKeyRegister from ':islands/PassKeyRegister.tsx'
import type { SessionPageProps } from ':src/session/mod.ts'
import type { User } from '@cohabit/resources-manager/models'
import { Button } from 'univoq'
export default function Profil({ state }: SessionPageProps) {
const user = state.session?.get<User>('user')
if (user) {
return (
<>
<h1>Mon compte</h1>
<section>
<pre>{ JSON.stringify(user, null, 2) }</pre>
</section>
<div>
<PassKeyRegister />
<Button label='Disconnect' variant='primary'>
Disconnect
</Button>
</div>
</>
)
}
return (
<>
<h1>Accéder à mon compte</h1>
<LoginForm />
</>
)
}