diff --git a/src/routes/index.tsx b/src/routes/index.tsx index cb37106..9c70365 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -10,6 +10,7 @@ import CoursePlayPage from "../pages/course/video"; import IndexPage from "../pages/index"; import LatestLearnPage from "../pages/latest-learn"; import LoginPage from "../pages/login"; +import PrivateRoute from "../compenents/private-route"; let RootPage: any = null; if (getToken()) { @@ -29,9 +30,6 @@ if (getToken()) { }); }); } else { - if (window.location.pathname !== "/login") { - window.location.href = "/login"; - } RootPage = ; } @@ -48,7 +46,7 @@ const routes: RouteObject[] = [ children: [ { path: "/", - element: , + element: } />, }, { path: "/login", @@ -56,15 +54,15 @@ const routes: RouteObject[] = [ }, { path: "/course/:courseId", - element: , + element: } />, }, { path: "/course/:courseId/hour/:hourId", - element: , + element: } />, }, { path: "/latest-learn", - element: , + element: } />, }, ], },