feat(frontend): implement step 11 — pages, components, and routing with React Query

This commit is contained in:
2026-03-26 19:19:08 -03:00
parent 45fc176f32
commit a4dc8577ba
9 changed files with 332 additions and 8 deletions

View File

@@ -1,8 +1,19 @@
import { createBrowserRouter } from 'react-router-dom'
import { lazy, Suspense } from 'react'
import { lazy, Suspense, ReactNode } from 'react'
import ProtectedRoute from '../components/ProtectedRoute'
const LoginPage = lazy(() => import('../pages/LoginPage'))
const DashboardPage = lazy(() => import('../pages/DashboardPage'))
const EntitiesPage = lazy(() => import('../pages/EntitiesPage'))
const LogsPage = lazy(() => import('../pages/LogsPage'))
function Protected({ children }: { children: ReactNode }) {
return (
<Suspense fallback={<div>Loading...</div>}>
<ProtectedRoute>{children}</ProtectedRoute>
</Suspense>
)
}
export const router = createBrowserRouter([
{
@@ -16,9 +27,25 @@ export const router = createBrowserRouter([
{
path: '/',
element: (
<Suspense fallback={<div>Loading...</div>}>
<Protected>
<DashboardPage />
</Suspense>
</Protected>
),
},
{
path: '/entities',
element: (
<Protected>
<EntitiesPage />
</Protected>
),
},
{
path: '/logs',
element: (
<Protected>
<LogsPage />
</Protected>
),
},
])