feat: add sign-in flow, routing shell, and searchable book list
Pin @testing-library/jest-dom to ~6.9.1 (6.10.0 is npm-deprecated). Claude-Session: https://claude.ai/code/session_01M9MLit5Ko3X4s7rzC5Kv7X
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { Navigate, Outlet, useLocation } from 'react-router'
|
||||
import { useAuth } from './AuthContext'
|
||||
|
||||
export function RequireAuth() {
|
||||
const { user, loading } = useAuth()
|
||||
const location = useLocation()
|
||||
if (loading) return <p className="p-6 text-slate-500">Loading…</p>
|
||||
if (!user) return <Navigate to="/login" replace state={{ from: location }} />
|
||||
return <Outlet />
|
||||
}
|
||||
Reference in New Issue
Block a user