add list user and part of user page

This commit is contained in:
2024-01-22 22:52:23 +01:00
parent 21cb673d33
commit 6f590cdaf7
44 changed files with 1469 additions and 186 deletions

View File

@@ -3,10 +3,11 @@ import './App.css'
import {Nav} from "./components/Nav.jsx";
import {createBrowserRouter, Outlet, RouterProvider, useRouteError} from "react-router-dom";
import {Home} from "./pages/Homepage.jsx";
import {AdminRoot} from "./pages/admin/AdminRoot.jsx";
import {AdminRoot, getAdminChildren} from "./pages/admin/AdminRoot.jsx";
import {AuthCallback} from "./components/auhCallback.jsx";
import {useAuthDispatch} from "./hooks/useAuth.jsx";
import {KeycloakContextProvider, useAuthDispatch} from "./hooks/useAuth.jsx";
import {check_validity} from "./utils/auth.js";
import {MemberList} from "./pages/admin/MemberList.jsx";
const router = createBrowserRouter([
{
@@ -21,16 +22,7 @@ const router = createBrowserRouter([
{
path: 'admin',
element: <AdminRoot/>,
children: [
{
path: '',
element: <div>Admin</div>
},
{
path: 'b',
element: <div>Admin B</div>
}
]
children: getAdminChildren()
}
]
},
@@ -51,6 +43,16 @@ function PageError() {
}
function Root() {
const dispatch = useAuthDispatch()
const isInit = useRef(false)
useEffect(() => {
if (isInit.current)
return;
isInit.current = true
check_validity(b => dispatch({type: 'init', val: b}))
}, []);
return <>
<header>
<Nav/>
@@ -64,19 +66,9 @@ function Root() {
function App() {
console.log('render')
const dispatch = useAuthDispatch()
const isInit = useRef(false)
useEffect(() => {
if (isInit.current)
return;
isInit.current = true
check_validity(b => dispatch({type: 'init', val: b}))
}, []);
return <RouterProvider router={router}/>;
return <KeycloakContextProvider>
<RouterProvider router={router}/>
</KeycloakContextProvider>;
}
export default App