Commit 18157566 by asranov0003

fix: create browser router

parent a0584e8a
...@@ -22,33 +22,26 @@ const Router: React.FC = () => { ...@@ -22,33 +22,26 @@ const Router: React.FC = () => {
const router = createBrowserRouter([ const router = createBrowserRouter([
{ {
path: "/auth", path: "/",
element: isAuthenticated && <Navigate to={"/home"} />,
children: [ children: [
{ {
index: true, path: "/auth/login",
element: isAuthenticated ? ( element: <Login />,
<Navigate to="/home" />
) : (
<Navigate to="/auth/login" />
),
},
{
path: "login",
element: isAuthenticated ? <Navigate to="/home" /> : <Login />,
}, },
{ {
path: "register", path: "/auth/register",
element: isAuthenticated ? <Navigate to="/home" /> : <Register />, element: <Register />,
}, },
{ {
path: "recover", path: "/auth/recover",
element: isAuthenticated ? <Navigate to="/home" /> : <Recover />, element: <Recover />,
}, },
], ],
}, },
{ {
path: "/", path: "/",
element: <ProtectedRoute element={<Layout />} redirectTo="/auth/login" />, element: <ProtectedRoute element={<Layout />} redirectTo="/" />,
children: [ children: [
{ {
path: "home", path: "home",
...@@ -70,7 +63,7 @@ const Router: React.FC = () => { ...@@ -70,7 +63,7 @@ const Router: React.FC = () => {
}, },
{ {
path: "/pincode", path: "/pincode",
element: isAuthenticated ? <Pincode /> : <Navigate to="/auth/login" />, element: <Pincode />,
}, },
{ {
path: "*", path: "*",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment