feat(frontend): implement center auth session flow with route guard

This commit is contained in:
root
2026-05-12 15:09:06 +00:00
parent 6219fbbcfe
commit d718128f89
12 changed files with 269 additions and 4 deletions

View File

@@ -1,6 +1,9 @@
import { Link, Outlet } from 'react-router-dom'
import { useAuth } from '../auth/auth-context'
export default function AppLayout() {
const { isAuthed, session, logout } = useAuth()
return (
<div style={{ display: 'grid', gridTemplateColumns: '220px 1fr', minHeight: '100vh' }}>
<aside style={{ borderRight: '1px solid #ddd', padding: 16 }}>
@@ -10,6 +13,18 @@ export default function AppLayout() {
<Link to="/chat"></Link>
<Link to="/login"></Link>
</nav>
<div style={{ marginTop: 16, fontSize: 12 }}>
{isAuthed ? (
<>
<div>{session?.user.email}</div>
<button onClick={() => logout()} style={{ marginTop: 6 }}>
</button>
</>
) : (
<span></span>
)}
</div>
</aside>
<main style={{ padding: 16 }}>
<Outlet />