articleRoutes.ts 812 B

1234567891011121314151617181920212223242526272829303132
  1. // src/routes/articleRoutes.ts
  2. import { lazy } from "react";
  3. import type { RouteObject } from "react-router";
  4. import { articleLoader } from "../api/article";
  5. const WorkspaceArticleList = lazy(() => import("../pages/workspace/article"));
  6. const WorkspaceArticleShow = lazy(
  7. () => import("../pages/workspace/article/show")
  8. );
  9. const articleRoutes: RouteObject[] = [
  10. {
  11. path: "article",
  12. handle: { id: "workspace.article", crumb: "article" },
  13. children: [
  14. {
  15. index: true,
  16. Component: WorkspaceArticleList,
  17. },
  18. {
  19. path: ":articleId",
  20. Component: WorkspaceArticleShow,
  21. loader: articleLoader,
  22. handle: {
  23. crumb: (match: { data: { title: string } }) => match.data.title,
  24. },
  25. },
  26. ],
  27. },
  28. ];
  29. export default articleRoutes;