Files
mitm-webserver/frontend/src/appRouter.tsx
malmert 6c5b5ef4a1
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 9s
nft rule post json
2026-02-11 21:26:58 +01:00

42 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// src/AppRouter.tsx
import { Navigate, Route, Routes } from 'react-router-dom';
import App from './App'; // your layout component (has <Outlet />)
import { Firewall } from './pages/Firewall';
import Home from './pages/Home';
import Network from './pages/Network';
import Scripting from './pages/Scripting';
import Sniffing from './pages/Sniffing';
import { PATHS } from './routes';
export default function AppRouter() {
return (
<Routes>
{/* App is the top-level layout; Outlet renders the active child route */}
<Route path={PATHS.ROOT} element={<App />}>
{/* When the user hits '/', redirect to '/home' */}
<Route index element={<Navigate to={PATHS.HOME} replace />} />
{/* Child routes - these render inside App's <Outlet /> */}
<Route path={PATHS.HOME.slice(1)} element={<Home />} />
<Route path={PATHS.NETWORK.slice(1)} element={<Network />} />
<Route path={PATHS.SNIFFING.slice(1)} element={<Sniffing />} />
<Route path={PATHS.SCRIPTING.slice(1)} element={<Scripting />} />
<Route path={PATHS.FIREWALL.slice(1)} element={<Firewall />} />
{/* Fallback (renders inside layout too) */}
<Route path="*" element={<NotFound />} />
</Route>
</Routes>
);
}
/** simple 404 rendered inside the layout */
function NotFound() {
return (
<div style={{ padding: 16 }}>
<h2>404 – Not Found</h2>
<p>The requested page does not exist.</p>
</div>
);
}