router.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
  3. *
  4. * @author John Molakvoæ <skjnldsv@protonmail.com>
  5. * @author Julius Härtl <jus@bitgrid.net>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. import Vue from 'vue'
  24. import Router from 'vue-router'
  25. import { generateUrl } from '@nextcloud/router'
  26. // Dynamic loading
  27. const Users = () => import('./views/Users')
  28. const Apps = () => import('./views/Apps')
  29. Vue.use(Router)
  30. /*
  31. * This is the list of routes where the vuejs app will
  32. * take over php to provide data
  33. * You need to forward the php routing (routes.php) to
  34. * the settings-vue template, where the vue-router will
  35. * ensure the proper route.
  36. * ⚠️ Routes needs to match the php routes.
  37. */
  38. export default new Router({
  39. mode: 'history',
  40. // if index.php is in the url AND we got this far, then it's working:
  41. // let's keep using index.php in the url
  42. base: generateUrl(''),
  43. linkActiveClass: 'active',
  44. routes: [
  45. {
  46. path: '/:index(index.php/)?settings/users',
  47. component: Users,
  48. props: true,
  49. name: 'users',
  50. children: [
  51. {
  52. path: ':selectedGroup',
  53. name: 'group',
  54. component: Users,
  55. },
  56. ],
  57. },
  58. {
  59. path: '/:index(index.php/)?settings/apps',
  60. component: Apps,
  61. props: true,
  62. name: 'apps',
  63. children: [
  64. {
  65. path: ':category',
  66. name: 'apps-category',
  67. component: Apps,
  68. children: [
  69. {
  70. path: ':id',
  71. name: 'apps-details',
  72. component: Apps,
  73. },
  74. ],
  75. },
  76. ],
  77. },
  78. ],
  79. })