diff options
Diffstat (limited to '')
| -rw-r--r-- | frontend/src/App.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/frontend/src/App.js b/frontend/src/App.js index 26aec98..c1745a7 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js | |||
| @@ -5,14 +5,23 @@ import Sidebar from "./components/sidebar.js" | |||
| 5 | import Main from "./components/main.js" | 5 | import Main from "./components/main.js" |
| 6 | import "./App.css"; | 6 | import "./App.css"; |
| 7 | 7 | ||
| 8 | import Summary from "./components/pages/summary.js" | ||
| 8 | 9 | ||
| 9 | 10 | ||
| 10 | export default function App() { | 11 | export default function App() { |
| 11 | 12 | ||
| 13 | const [token, setToken] = React.useState(null); | ||
| 14 | const [mod,setMod] = React.useState(false) | ||
| 15 | React.useEffect(()=>{ | ||
| 16 | if(token!==null){ | ||
| 17 | setMod(JSON.parse(atob(token.split(".")[1])).mod) | ||
| 18 | } | ||
| 19 | },[token]) | ||
| 20 | |||
| 12 | return ( | 21 | return ( |
| 13 | <> | 22 | <> |
| 14 | <BrowserRouter> | 23 | <BrowserRouter> |
| 15 | <Sidebar/> | 24 | <Sidebar token={token} setToken={setToken}/> |
| 16 | <Routes> | 25 | <Routes> |
| 17 | <Route index element={<Main text="Homepage"/>}></Route> | 26 | <Route index element={<Main text="Homepage"/>}></Route> |
| 18 | <Route path="/news" element={<Main text="News"/>}></Route> | 27 | <Route path="/news" element={<Main text="News"/>}></Route> |
| @@ -23,7 +32,8 @@ export default function App() { | |||
| 23 | <Route path="/profile" element={<Main text="Profile"/>}></Route> | 32 | <Route path="/profile" element={<Main text="Profile"/>}></Route> |
| 24 | <Route path="/rules" element={<Main text="Rules"/>}></Route> | 33 | <Route path="/rules" element={<Main text="Rules"/>}></Route> |
| 25 | <Route path="/about" element={<Main text="About"/>}></Route> | 34 | <Route path="/about" element={<Main text="About"/>}></Route> |
| 26 | <Route path="*" element={<Main text="404"/>}></Route> | 35 | <Route path="/maps/*" element={<Summary token={token} mod={mod}/>}></Route> |
| 36 | <Route path="*" element={<Main text="404 Page not found"/>}></Route> | ||
| 27 | </Routes> | 37 | </Routes> |
| 28 | </BrowserRouter> | 38 | </BrowserRouter> |
| 29 | </> | 39 | </> |