Private
Public Access
Invite-only FastAPI + SQLAlchemy(async) + Postgres backend (session-cookie auth via CLI-provisioned accounts, open-room CRUD, single-instance /ws/chat) and a React + Vite PWA frontend (login, room list, chat view). Backend tests pass against a local Postgres DB. See README.md and backend/README.md for setup, and ARCHITECTURE.md for the full phased design. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
13 lines
365 B
TypeScript
13 lines
365 B
TypeScript
import type { ReactNode } from 'react'
|
|
import { Navigate } from 'react-router-dom'
|
|
import { useAuth } from '../context/AuthContext'
|
|
|
|
export function ProtectedRoute({ children }: { children: ReactNode }) {
|
|
const { user, loading } = useAuth()
|
|
|
|
if (loading) return <p>Loading...</p>
|
|
if (!user) return <Navigate to="/login" replace />
|
|
|
|
return <>{children}</>
|
|
}
|