routes.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. let sub_routes = [];
  2. const modules = import.meta.glob("./routes/*.route.js", { eager: true });
  3. // eslint-disable-next-line no-unused-vars
  4. Object.entries(modules).forEach(([path, definition]) => {
  5. sub_routes = sub_routes.concat(definition.default);
  6. });
  7. const routes = [
  8. {
  9. path: "/",
  10. component: () => import("layouts/MainLayout.vue"),
  11. meta: { requireAuth: true },
  12. children: [
  13. {
  14. path: "",
  15. name: "HomePage",
  16. component: () => import("src/pages/home/HomePage.vue"),
  17. meta: {
  18. requireAuth: true,
  19. },
  20. },
  21. {
  22. path: "/dashboard",
  23. name: "DashboardPage",
  24. component: () => import("pages/dashboard/DashboardPage.vue"),
  25. meta: {
  26. title: { value: "Dashboard" },
  27. requireAuth: true,
  28. requiredPermission: "dashboard",
  29. breadcrumbs: [
  30. {
  31. name: "DashboardPage",
  32. title: "Dashboard",
  33. },
  34. ],
  35. },
  36. },
  37. {
  38. path: "/versions",
  39. name: "SystemVersionsPage",
  40. component: () => import("pages/version/SystemVersionsPage.vue"),
  41. meta: {
  42. title: {
  43. value: "ui.navigation.versions",
  44. translate: true,
  45. },
  46. description: {
  47. value: "page.versions.description",
  48. translate: true,
  49. },
  50. requireAuth: true,
  51. breadcrumbs: [
  52. {
  53. name: "SystemVersionsPage",
  54. title: "ui.navigation.versions",
  55. translate: true,
  56. },
  57. ],
  58. },
  59. },
  60. ...sub_routes,
  61. ],
  62. },
  63. {
  64. path: "/login",
  65. component: () => import("layouts/LoginLayout.vue"),
  66. children: [
  67. {
  68. path: "",
  69. name: "LoginPage",
  70. component: () => import("pages/login/LoginPage.vue"),
  71. meta: {
  72. title: "Login",
  73. },
  74. },
  75. ],
  76. },
  77. {
  78. path: "/forgot-my-password",
  79. component: () => import("layouts/LoginLayout.vue"),
  80. meta: { public: true },
  81. children: [
  82. {
  83. path: "",
  84. name: "ForgotMyPasswordPage",
  85. component: () => import("pages/ForgotMyPasswordPage.vue"),
  86. meta: { public: true },
  87. },
  88. ],
  89. },
  90. {
  91. path: "/recovery-password",
  92. component: () => import("layouts/LoginLayout.vue"),
  93. meta: { public: true },
  94. children: [
  95. {
  96. path: "",
  97. name: "RecoveryPasswordPage",
  98. component: () => import("pages/RecoveryPasswordPage.vue"),
  99. meta: { public: true },
  100. },
  101. ],
  102. },
  103. // Always leave this as last one,
  104. // but you can also remove it
  105. {
  106. path: "/:catchAll(.*)*",
  107. component: () => import("pages/ErrorNotFound.vue"),
  108. },
  109. ];
  110. export default routes;