🔀 refactor(routes.tsx): use useEffect hook to redirect from root to /flows for better code organization and readability
This commit is contained in:
parent
225d6da419
commit
0c882cec44
1 changed files with 7 additions and 6 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { useEffect } from "react";
|
||||
import { Route, Routes, useNavigate } from "react-router-dom";
|
||||
import { ProtectedAdminRoute } from "./components/authAdminGuard";
|
||||
import { ProtectedRoute } from "./components/authGuard";
|
||||
|
|
@ -22,12 +23,12 @@ import SignUp from "./pages/signUpPage";
|
|||
|
||||
const Router = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
// Redirect from root to /flows
|
||||
if (window.location.pathname === "/") {
|
||||
navigate("/flows");
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
// Redirect from root to /flows
|
||||
if (window.location.pathname === "/") {
|
||||
navigate("/flows");
|
||||
}
|
||||
}, [navigate]);
|
||||
return (
|
||||
<Routes>
|
||||
<Route
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue