Wrapped /register in admin check HOC, added register/:token route
This commit is contained in:
1 parent
dcb7ccee80
commit
bd2422c90a
2 files changed
+8
-5
No files matched your search
+7
-3
@@ -1,4 +1,6 @@
|
|||||||
import { Routes, Route } from "react-router-dom";
|
import { Routes, Route } from "react-router-dom";
|
||||||
|
import "react-toastify/dist/ReactToastify.css";
|
||||||
|
import { ToastContainer } from "react-toastify";
|
||||||
// import "./App.css";
|
// import "./App.css";
|
||||||
import NotFound from "./Pages/NotFound";
|
import NotFound from "./Pages/NotFound";
|
||||||
import Login from "./Pages/Auth/Login";
|
import Login from "./Pages/Auth/Login";
|
||||||
@@ -18,10 +20,10 @@ import NewPasswordConfirmed from "./Pages/Auth/NewPasswordConfirmed";
|
|||||||
import ProtectedRoute from "./Components/ProtectedRoute";
|
import ProtectedRoute from "./Components/ProtectedRoute";
|
||||||
import Details from "./Pages/Monitors/Details";
|
import Details from "./Pages/Monitors/Details";
|
||||||
import Maintenance from "./Pages/Maintenance";
|
import Maintenance from "./Pages/Maintenance";
|
||||||
import "react-toastify/dist/ReactToastify.css";
|
import withAdminCheck from "./HOC/withAdminCheck";
|
||||||
import { ToastContainer } from "react-toastify";
|
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
const AdminCheckedRegister = withAdminCheck(Register);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Routes>
|
<Routes>
|
||||||
@@ -79,7 +81,9 @@ function App() {
|
|||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
<Route exact path="/login" element={<Login />} />
|
<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="/toast" element={<ToastComponent />} /> */}
|
||||||
<Route path="*" element={<NotFound />} />
|
<Route path="*" element={<NotFound />} />
|
||||||
<Route path="/forgot-password" element={<ForgotPassword />} />
|
<Route path="/forgot-password" element={<ForgotPassword />} />
|
||||||
|
|||||||
@@ -230,5 +230,4 @@ const Register = ({ isAdmin }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const WrappedRegister = withAdminCheck(Register);
|
export default Register;
|
||||||
export default WrappedRegister;
|
|
||||||
Reference in new issue
Block a user