Wrapped /register in admin check HOC, added register/:token route

This commit is contained in:
Alex Holliday
2024-07-19 10:40:40 -07:00
parent dcb7ccee80
commit bd2422c90a
2 changed files with 8 additions and 5 deletions
+7 -3
View File
@@ -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 (
<>
<Routes>
@@ -79,7 +81,9 @@ function App() {
</Route>
<Route exact path="/login" element={<Login />} />
<Route exact path="/register" element={<Register />} />
<Route exact path="/register" element={<AdminCheckedRegister />} />
<Route exact path="/register/:token" element={<Register />} />
{/* <Route path="/toast" element={<ToastComponent />} /> */}
<Route path="*" element={<NotFound />} />
<Route path="/forgot-password" element={<ForgotPassword />} />
+1 -2
View File
@@ -230,5 +230,4 @@ const Register = ({ isAdmin }) => {
);
};
const WrappedRegister = withAdminCheck(Register);
export default WrappedRegister;
export default Register;