-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
28 lines (26 loc) · 1021 Bytes
/
Copy pathApp.js
File metadata and controls
28 lines (26 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import React, { useState } from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import Login from './pages/login';
import Dashboard from './pages/dashboard';
import ThreatCenter from './pages/ThreatCentre';
import AIAnalysis from './pages/AIAnalysis';
import Reports from './pages/Reports';
import Layout from './components/Layout';
import './index.css';
function App() {
const [isLoggedIn, setIsLoggedIn] = useState(false);
return (
<Router>
<Routes>
<Route path="/login" element={<Login onLogin={() => setIsLoggedIn(true)} />} />
<Route path="/" element={isLoggedIn ? <Layout /> : <Navigate to="/login" />}>
<Route index element={<Dashboard />} />
<Route path="threats" element={<ThreatCenter />} />
<Route path="ai-analysis" element={<AIAnalysis />} />
<Route path="reports" element={<Reports />} />
</Route>
</Routes>
</Router>
);
}
export default App;