From bd2422c90aabc15b3ffcbc3451645d02701397ad Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Fri, 19 Jul 2024 10:40:40 -0700 Subject: [PATCH] Wrapped /register in admin check HOC, added register/:token route --- Client/src/App.jsx | 10 +++++++--- Client/src/Pages/Auth/Register/Register.jsx | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Client/src/App.jsx b/Client/src/App.jsx index 622c8c79b..a10228795 100644 --- a/Client/src/App.jsx +++ b/Client/src/App.jsx @@ -1,4 +1,6 @@ import { Routes, Route } from "react-router-dom"; +import "react-toastify/dist/ReactToastify.css"; +import { ToastContainer } from "react-toastify"; // import "./App.css"; import NotFound from "./Pages/NotFound"; import Login from "./Pages/Auth/Login"; @@ -18,10 +20,10 @@ import NewPasswordConfirmed from "./Pages/Auth/NewPasswordConfirmed"; import ProtectedRoute from "./Components/ProtectedRoute"; import Details from "./Pages/Monitors/Details"; import Maintenance from "./Pages/Maintenance"; -import "react-toastify/dist/ReactToastify.css"; -import { ToastContainer } from "react-toastify"; +import withAdminCheck from "./HOC/withAdminCheck"; function App() { + const AdminCheckedRegister = withAdminCheck(Register); return ( <> @@ -79,7 +81,9 @@ function App() { } /> - } /> + + } /> + } /> {/* } /> */} } /> } /> diff --git a/Client/src/Pages/Auth/Register/Register.jsx b/Client/src/Pages/Auth/Register/Register.jsx index cb68cc349..c1140ea73 100644 --- a/Client/src/Pages/Auth/Register/Register.jsx +++ b/Client/src/Pages/Auth/Register/Register.jsx @@ -230,5 +230,4 @@ const Register = ({ isAdmin }) => { ); }; -const WrappedRegister = withAdminCheck(Register); -export default WrappedRegister; +export default Register;