feat(web): TanStack Query hooks + session-guarded routes

Installs @tanstack/react-query and react-router-dom; adds typed query
hooks (useMe, useObjectsPage, useObject, useFieldDefinitions, useLogin,
useLogout), a QueryClient+MemoryRouter test render helper, and
RequireAuth — a layout route that blocks unauthenticated access and
redirects to /login. All 7 tests pass, typecheck/lint/build clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 22:49:55 +02:00
parent 2e4187c850
commit cf02eeb991
6 changed files with 213 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
import { Navigate, Outlet } from "react-router-dom";
import { useMe } from "../api/queries";
export function RequireAuth() {
const { data: user, isLoading } = useMe();
if (isLoading) return <div role="status" aria-label="loading" />;
if (!user) return <Navigate to="/login" replace />;
return <Outlet />;
}