Demo auth, seed import/reset, dashboard, vehicle/booking list+detail, audit trail. Backend: 19 tests passing, ruff clean. Frontend: React Router shell, typed API client, responsive pages. Verified end-to-end via curl and browser.
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { Navigate, Route, Routes } from "react-router-dom";
|
|
import { AuthProvider } from "./context/AuthContext";
|
|
import { Layout } from "./components/Layout";
|
|
import { RequireAuth } from "./components/RequireAuth";
|
|
import { Login } from "./pages/Login";
|
|
import { Dashboard } from "./pages/Dashboard";
|
|
import { Vehicles } from "./pages/Vehicles";
|
|
import { VehicleDetail } from "./pages/VehicleDetail";
|
|
import { Bookings } from "./pages/Bookings";
|
|
import { BookingDetail } from "./pages/BookingDetail";
|
|
import { Audit } from "./pages/Audit";
|
|
|
|
export function App() {
|
|
return (
|
|
<AuthProvider>
|
|
<Routes>
|
|
<Route path="/login" element={<Login />} />
|
|
<Route
|
|
element={
|
|
<RequireAuth>
|
|
<Layout />
|
|
</RequireAuth>
|
|
}
|
|
>
|
|
<Route path="/dashboard" element={<Dashboard />} />
|
|
<Route path="/vehicles" element={<Vehicles />} />
|
|
<Route path="/vehicles/:publicRef" element={<VehicleDetail />} />
|
|
<Route path="/bookings" element={<Bookings />} />
|
|
<Route path="/bookings/:publicRef" element={<BookingDetail />} />
|
|
<Route path="/audit" element={<Audit />} />
|
|
</Route>
|
|
<Route path="/" element={<Navigate to="/dashboard" replace />} />
|
|
<Route path="*" element={<Navigate to="/dashboard" replace />} />
|
|
</Routes>
|
|
</AuthProvider>
|
|
);
|
|
}
|