index.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import Vue from 'vue';
  2. import VueRouter from 'vue-router';
  3. Vue.use(VueRouter);
  4. // The meta.group param is used in App.vue to expand menu group by name.
  5. const routes = [
  6. {
  7. path: '/',
  8. name: 'dashboard',
  9. meta: { title: 'Dashboard' },
  10. component: () => import(/* webpackChunkName: "main" */ '../views/Dashboard.vue'),
  11. },
  12. {
  13. path: '/lists',
  14. name: 'lists',
  15. meta: { title: 'Lists', group: 'lists' },
  16. component: () => import(/* webpackChunkName: "main" */ '../views/Lists.vue'),
  17. },
  18. {
  19. path: '/lists/forms',
  20. name: 'forms',
  21. meta: { title: 'Forms', group: 'lists' },
  22. component: () => import(/* webpackChunkName: "main" */ '../views/Forms.vue'),
  23. },
  24. {
  25. path: '/subscribers',
  26. name: 'subscribers',
  27. meta: { title: 'Subscribers', group: 'subscribers' },
  28. component: () => import(/* webpackChunkName: "main" */ '../views/Subscribers.vue'),
  29. },
  30. {
  31. path: '/subscribers/import',
  32. name: 'import',
  33. meta: { title: 'Import subscribers', group: 'subscribers' },
  34. component: () => import(/* webpackChunkName: "main" */ '../views/Import.vue'),
  35. },
  36. {
  37. path: '/subscribers/bounces',
  38. name: 'bounces',
  39. meta: { title: 'Bounces', group: 'subscribers' },
  40. component: () => import(/* webpackChunkName: "main" */ '../views/Bounces.vue'),
  41. },
  42. {
  43. path: '/subscribers/lists/:listID',
  44. name: 'subscribers_list',
  45. meta: { title: 'Subscribers', group: 'subscribers' },
  46. component: () => import(/* webpackChunkName: "main" */ '../views/Subscribers.vue'),
  47. },
  48. {
  49. path: '/subscribers/:id',
  50. name: 'subscriber',
  51. meta: { title: 'Subscribers', group: 'subscribers' },
  52. component: () => import(/* webpackChunkName: "main" */ '../views/Subscribers.vue'),
  53. },
  54. {
  55. path: '/campaigns',
  56. name: 'campaigns',
  57. meta: { title: 'Campaigns', group: 'campaigns' },
  58. component: () => import(/* webpackChunkName: "main" */ '../views/Campaigns.vue'),
  59. },
  60. {
  61. path: '/campaigns/media',
  62. name: 'media',
  63. meta: { title: 'Media', group: 'campaigns' },
  64. component: () => import(/* webpackChunkName: "main" */ '../views/Media.vue'),
  65. },
  66. {
  67. path: '/campaigns/templates',
  68. name: 'templates',
  69. meta: { title: 'Templates', group: 'campaigns' },
  70. component: () => import(/* webpackChunkName: "main" */ '../views/Templates.vue'),
  71. },
  72. {
  73. path: '/campaigns/analytics',
  74. name: 'campaignAnalytics',
  75. meta: { title: 'Campaign analytics', group: 'campaigns' },
  76. component: () => import(/* webpackChunkName: "main" */ '../views/CampaignAnalytics.vue'),
  77. },
  78. {
  79. path: '/campaigns/:id',
  80. name: 'campaign',
  81. meta: { title: 'Campaign', group: 'campaigns' },
  82. component: () => import(/* webpackChunkName: "main" */ '../views/Campaign.vue'),
  83. },
  84. {
  85. path: '/settings',
  86. name: 'settings',
  87. meta: { title: 'Settings', group: 'settings' },
  88. component: () => import(/* webpackChunkName: "main" */ '../views/Settings.vue'),
  89. },
  90. {
  91. path: '/settings/logs',
  92. name: 'logs',
  93. meta: { title: 'Logs', group: 'settings' },
  94. component: () => import(/* webpackChunkName: "main" */ '../views/Logs.vue'),
  95. },
  96. ];
  97. const router = new VueRouter({
  98. mode: 'history',
  99. base: process.env.BASE_URL,
  100. routes,
  101. scrollBehavior(to) {
  102. if (to.hash) {
  103. return { selector: to.hash };
  104. }
  105. return { x: 0, y: 0 };
  106. },
  107. });
  108. router.afterEach((to) => {
  109. Vue.nextTick(() => {
  110. document.title = `${to.meta.title} / listmonk`;
  111. });
  112. });
  113. export default router;