fixes
This commit is contained in:
parent
03a2c7b546
commit
c921d08238
21
src/App.js
21
src/App.js
@ -13,6 +13,7 @@ import PrivateRoute from './structures/PrivateRoute';
|
||||
import { UnauthedRoute } from './structures/UnauthedRoute';
|
||||
import Users from './pages/Users';
|
||||
import Admin from './pages/Admin';
|
||||
import TitledPage from './components/TitledPage';
|
||||
|
||||
function App() {
|
||||
|
||||
@ -56,10 +57,22 @@ function App() {
|
||||
<div className='main-content'>
|
||||
<ErrorBoundary>
|
||||
<Routes>
|
||||
<Route path='/home/*' element={<PrivateRoute><Home /></PrivateRoute >} />
|
||||
<Route path='/users/*' element={<PrivateRoute><Users /></PrivateRoute >} />
|
||||
<Route path='/admin/*' element={<PrivateRoute><Admin /></PrivateRoute >} />
|
||||
<Route path='/login/*' element={<UnauthedRoute><Login /></UnauthedRoute>} />
|
||||
<Route path='/home/*' element={<PrivateRoute>
|
||||
<TitledPage title='Home'>
|
||||
<Home />
|
||||
</TitledPage>
|
||||
</PrivateRoute >} />
|
||||
<Route path='/users/*' element={<PrivateRoute>
|
||||
<TitledPage title='Users' >
|
||||
<Users />
|
||||
</TitledPage>
|
||||
</PrivateRoute >} />
|
||||
<Route path='/admin/*' element={<PrivateRoute>
|
||||
<Admin />
|
||||
</PrivateRoute >} />
|
||||
<Route path='/login/*' element={<UnauthedRoute>
|
||||
<Login />
|
||||
</UnauthedRoute>} />
|
||||
<Route path='*' element={<Navigate to='/home' />} />
|
||||
</Routes>
|
||||
</ErrorBoundary>
|
||||
|
14
src/components/TitledPage.js
Normal file
14
src/components/TitledPage.js
Normal file
@ -0,0 +1,14 @@
|
||||
import React from "react";
|
||||
import '../css/pages/Empty.css';
|
||||
|
||||
const TitledPage = ({title, children}) => {
|
||||
|
||||
return <div className="page">
|
||||
<h2 className="pageTitle">{title}</h2>
|
||||
<div className='card'>
|
||||
{children}
|
||||
</div>
|
||||
</div>;
|
||||
};
|
||||
|
||||
export default TitledPage;
|
@ -1,13 +0,0 @@
|
||||
import React from "react";
|
||||
import '../css/pages/Empty.css';
|
||||
|
||||
const Empty = () => {
|
||||
|
||||
return <div className="user-page">
|
||||
<h2 className="pageTitle">Empty</h2>
|
||||
<div className='card'>
|
||||
</div>
|
||||
</div>;
|
||||
};
|
||||
|
||||
export default Empty;
|
@ -5,14 +5,11 @@ import { get } from "../util/Util";
|
||||
const Home = () => {
|
||||
|
||||
return <div className="user-page">
|
||||
<h2 className="pageTitle">Home</h2>
|
||||
<div className='card'>
|
||||
<button onClick={async () => {
|
||||
console.log(await get('/api/test'));
|
||||
}}>
|
||||
Test
|
||||
</button>
|
||||
</div>
|
||||
<button onClick={async () => {
|
||||
console.log(await get('/api/test'));
|
||||
}}>
|
||||
Test
|
||||
</button>
|
||||
</div>;
|
||||
};
|
||||
|
||||
|
@ -186,7 +186,7 @@ const CreateUserField = () => {
|
||||
<input autoComplete="off" type='text' id='username' />
|
||||
|
||||
<label htmlFor="password">Password</label>
|
||||
<input autoComplete="off" type='password' id='username' />
|
||||
<input autoComplete="off" type='password' id='password' />
|
||||
</form>
|
||||
</div>;
|
||||
|
||||
@ -245,22 +245,14 @@ const Users = () => {
|
||||
</div>;
|
||||
};
|
||||
|
||||
return <div className="user-page">
|
||||
<h2 className="pageTitle">Users</h2>
|
||||
return <div className="user-list">
|
||||
{error && <p>{error}</p>}
|
||||
|
||||
<div className='card'>
|
||||
<div className="user-list">
|
||||
<ErrorBoundary>
|
||||
<Routes>
|
||||
<Route path='/:id/*' element={<UserWrapper />} />
|
||||
<Route path='/' element={<UserListWrapper />} />
|
||||
</Routes>
|
||||
</ErrorBoundary>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<ErrorBoundary>
|
||||
<Routes>
|
||||
<Route path='/:id/*' element={<UserWrapper />} />
|
||||
<Route path='/' element={<UserListWrapper />} />
|
||||
</Routes>
|
||||
</ErrorBoundary>
|
||||
</div>;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user