mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-13 09:17:30 -05:00
closer to working
This commit is contained in:
@@ -27,22 +27,6 @@ const App = (params) => {
|
||||
</Routes>
|
||||
</div>
|
||||
)
|
||||
/*
|
||||
return (
|
||||
<div>
|
||||
<NavigationContainer />
|
||||
<Routes>
|
||||
<Route path="/about" element={<About />} component={Restricted(About, store)} />
|
||||
<Route path="/system/:shortName" component={Restricted(SystemContainer, store)} />
|
||||
<Route path="/update-system/:shortName" component={Restricted(UpdateSystemContainer, store)} />
|
||||
<Route path="/create-system" component={Restricted(CreateSystemContainer, store)} />
|
||||
<Route path="/list-systems" component={Restricted(ListSystemsContainer, store)} />
|
||||
<Route path="/" component={Restricted(ListSystemsContainer, store)} />
|
||||
<Route render={() => (<div>Miss</div>)} />
|
||||
</Routes>
|
||||
</div>
|
||||
)*/
|
||||
|
||||
};
|
||||
|
||||
export default App
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import React, { useEffect} from "react";
|
||||
import { useSelector, useDispatch } from 'react-redux'
|
||||
import { authenticateUser } from "../features/user/userSlice";
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
/**
|
||||
* Higher-order component (HOC) to wrap restricted pages
|
||||
*/
|
||||
@@ -9,14 +10,21 @@ import { authenticateUser } from "../features/user/userSlice";
|
||||
const Restricted = ({children }) => {
|
||||
const { authenticated, hasAuthenticated } = useSelector((state) => state.user);
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(authenticateUser({}));
|
||||
},[]);
|
||||
|
||||
if (authenticated) {
|
||||
return children;;
|
||||
}
|
||||
if (hasAuthenticated) {
|
||||
if (authenticated) {
|
||||
return children;;
|
||||
}
|
||||
else {
|
||||
|
||||
navigate("/list-systems")
|
||||
}
|
||||
}
|
||||
return <div/>
|
||||
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useLayoutEffect, useState, useRef, useCallback, useMemo } from "react";
|
||||
import React, { useEffect, useState, } from "react";
|
||||
import { useGetSystemsQuery, useGetTalkgroupsQuery, useGetGroupsQuery, useUpdateGroupMutation, useCreateGroupMutation, useDeleteGroupMutation, useSaveGroupOrderMutation} from '../features/api/apiSlice'
|
||||
|
||||
import {
|
||||
@@ -105,7 +105,6 @@ const GroupModal = (props) => {
|
||||
setTalkgroups(talkgroups);
|
||||
}
|
||||
|
||||
const handleInputChange = (e, { name, value }) => this.setState({ [name]: value });
|
||||
|
||||
const addTalkgroup = (event, index) => {
|
||||
const item = {
|
||||
|
||||
Reference in New Issue
Block a user