cleaned up admin

This commit is contained in:
Luke Berndt
2023-04-05 21:16:53 -04:00
parent efe3794eee
commit f7f5265264
26 changed files with 149 additions and 304 deletions

View File

@@ -1,4 +1,3 @@
import React, { Component } from "react"
import Navigation from "./Navigation"
import { Routes, Route } from 'react-router-dom';
@@ -12,7 +11,6 @@ import CreateSystem from "../System/CreateSystem"
const App = (params) => {
const {store} = params;
return (
<div>
<Navigation/>

View File

@@ -1,15 +1,11 @@
import { Link } from "react-router-dom";
import { Menu, Dropdown } from "semantic-ui-react";
import React, { useEffect } from "react";
import { useSelector, useDispatch } from 'react-redux'
import { logoutUser } from "../features/user/userSlice";
const navStyle = {
marginBottom: "30px"
};
const blankStyle = {
marginBottom: "50px"
};
const Navigation = (props) => {
const dispatch = useDispatch();

View File

@@ -2,7 +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
*/
@@ -10,8 +10,6 @@ import { useNavigate } from 'react-router-dom';
const Restricted = ({children }) => {
const { authenticated, hasAuthenticated } = useSelector((state) => state.user);
const dispatch = useDispatch();
const navigate = useNavigate();
useEffect(() => {
dispatch(authenticateUser({}));
},[]);
@@ -21,8 +19,7 @@ const Restricted = ({children }) => {
return children;;
}
else {
navigate("/list-systems")
window.location = process.env.REACT_APP_ACCOUNT_SERVER + "/login?nextLocation=admin";
}
}
return <div/>