From 976698e4b843e65a0a571eae13052bada2cec64a Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Sun, 20 Nov 2022 18:39:39 +0200 Subject: [PATCH] route stuff --- src/App.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/App.js b/src/App.js index f20299f..f35e1d9 100644 --- a/src/App.js +++ b/src/App.js @@ -1,5 +1,5 @@ import React, { useEffect } from 'react'; -import { BrowserRouter, Route, Routes} from 'react-router-dom'; +import { BrowserRouter, Navigate, Route, Routes} from 'react-router-dom'; import './css/App.css'; import Home from './pages/Home'; @@ -9,6 +9,10 @@ import UserControls from './components/UserControls'; import { useLoginContext } from './structures/UserContext'; import Login from './pages/Login'; import { fetchUser } from './util/Util'; +import PrivateRoute from './structures/PrivateRoute'; +import { UnauthedRoute } from './structures/UnauthedRoute'; +import Users from './pages/Users'; +import Admin from './pages/Admin'; function App() { @@ -19,7 +23,7 @@ function App() { }, []); const menuItems = [ - { to: '/', label: 'Home' }, + { to: '/home', label: 'Home' }, { to: '/users', label: 'Users' }, { to: '/admin', label: 'Admin' } @@ -32,22 +36,25 @@ function App() { - {user ? -
+
+ {user ? SIDEBAR - - - + + : null}
- } /> + } /> + } /> + } /> + } /> + } />
@@ -56,7 +63,6 @@ function App() {
- : }
);