Shield external portal jumps (keep EXTERNAL_* for later), serve /nav from static build, and proxy /book + /community to vertical Next apps with Caddy notes. Co-authored-by: Cursor <cursoragent@cursor.com>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { Navigate, Route, Routes } from 'react-router-dom'
|
|
import { getToken } from './api'
|
|
import Login from './pages/Login'
|
|
import Dashboard from './pages/Dashboard'
|
|
import BookEdit from './pages/BookEdit'
|
|
import './pages/BookEdit.css'
|
|
import Orders from './pages/Orders'
|
|
import Users from './pages/Users'
|
|
import Events from './pages/Events'
|
|
import Checklist from './pages/Checklist'
|
|
import Layout from './components/Layout'
|
|
|
|
function Private({ children }: { children: React.ReactNode }) {
|
|
if (!getToken()) return <Navigate to="/login" replace />
|
|
return <>{children}</>
|
|
}
|
|
|
|
export default function App() {
|
|
return (
|
|
<Routes>
|
|
<Route path="/login" element={<Login />} />
|
|
<Route
|
|
path="/"
|
|
element={
|
|
<Private>
|
|
<Layout />
|
|
</Private>
|
|
}
|
|
>
|
|
<Route index element={<Dashboard />} />
|
|
<Route path="books/:id" element={<BookEdit />} />
|
|
<Route path="orders" element={<Orders />} />
|
|
<Route path="users" element={<Users />} />
|
|
<Route path="events" element={<Events />} />
|
|
<Route path="checklist" element={<Checklist />} />
|
|
</Route>
|
|
</Routes>
|
|
)
|
|
}
|