|
|
|
@@ -1,4 +1,5 @@ |
|
|
|
import { SeasonTicketContractContextProvider } from "contexts/dashboard/SeasonTicketContractContext"; |
|
|
|
import AuthGuard from "guards/AuthGuard"; |
|
|
|
import useAuth from "hooks/useAuth"; |
|
|
|
import DashboardLayout from "layouts/dashbord"; |
|
|
|
import { PageID } from "pages"; |
|
|
|
@@ -8,11 +9,7 @@ import { Loadable } from "routes"; |
|
|
|
import { getRoute } from "routes/path"; |
|
|
|
|
|
|
|
export default function DashboardRoutes(): RouteObject[] { |
|
|
|
const { authenticated } = useAuth(); |
|
|
|
|
|
|
|
const children: RouteObject[] = useMemo(() => { |
|
|
|
if (!authenticated) return []; |
|
|
|
|
|
|
|
const Dashboard = Loadable(lazy(() => import("pages/dashboard"))); |
|
|
|
const ContractEntry = Loadable( |
|
|
|
lazy(() => import("pages/dashboard/contract/entry")) |
|
|
|
@@ -74,11 +71,9 @@ export default function DashboardRoutes(): RouteObject[] { |
|
|
|
...others, |
|
|
|
path: getRoute(pageId), |
|
|
|
})); |
|
|
|
}, [authenticated]); |
|
|
|
}, []); |
|
|
|
|
|
|
|
const seasonTicketContractChildren: RouteObject[] = useMemo(() => { |
|
|
|
if (!authenticated) return []; |
|
|
|
|
|
|
|
const ContractList = Loadable( |
|
|
|
lazy(() => import("pages/dashboard/contract/list")) |
|
|
|
); |
|
|
|
@@ -163,11 +158,15 @@ export default function DashboardRoutes(): RouteObject[] { |
|
|
|
...others, |
|
|
|
path: getRoute(pageId), |
|
|
|
})); |
|
|
|
}, [authenticated]); |
|
|
|
}, []); |
|
|
|
|
|
|
|
return [ |
|
|
|
{ |
|
|
|
element: <DashboardLayout />, |
|
|
|
element: ( |
|
|
|
<AuthGuard> |
|
|
|
<DashboardLayout /> |
|
|
|
</AuthGuard> |
|
|
|
), |
|
|
|
children: children, |
|
|
|
}, |
|
|
|
{ |
|
|
|
|