routes.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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: "DashboardPage",
  16. component: () => import("src/pages/dashboard/DashboardPage.vue"),
  17. meta: {
  18. title: "ui.navigation.dashboard",
  19. requireAuth: true,
  20. requiredPermission: "dashboard",
  21. breadcrumbs: [
  22. {
  23. name: "DashboardPage",
  24. title: "ui.navigation.dashboard",
  25. },
  26. ],
  27. },
  28. },
  29. ...sub_routes,
  30. ],
  31. },
  32. {
  33. path: "/login",
  34. component: () => import("layouts/LoginLayout.vue"),
  35. children: [
  36. {
  37. path: "",
  38. name: "LoginPage",
  39. component: () => import("pages/LoginPage.vue"),
  40. meta: {
  41. title: "Login",
  42. },
  43. },
  44. ],
  45. },
  46. {
  47. path: "/location",
  48. component: () => import("layouts/LoginLayout.vue"),
  49. children: [
  50. {
  51. path: "map",
  52. name: "LocationMapPage",
  53. component: () => import("pages/location/LocationMapPage.vue"),
  54. meta: { title: "Confirmar localização" },
  55. },
  56. {
  57. path: "address",
  58. name: "AddressCompletionPage",
  59. component: () => import("pages/location/AddressCompletionPage.vue"),
  60. meta: { title: "Confirmar endereço" },
  61. },
  62. ],
  63. },
  64. // Always leave this as last one,
  65. // but you can also remove it
  66. {
  67. path: "/:catchAll(.*)*",
  68. component: () => import("pages/ErrorNotFound.vue"),
  69. },
  70. ];
  71. export default routes;