add list user and part of user page
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user