routes.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import type { RouteRecordRaw } from 'vue-router'
  3. const routes: RouteRecordRaw[] = [
  4. {
  5. path: '/search/:type?',
  6. name: 'SearchOverview',
  7. props: true,
  8. component: () => import('./views/SearchOverview.vue'),
  9. beforeEnter(to) {
  10. const redirectedHash = to.redirectedFrom?.hash
  11. // if redirected from hash-based route, get search from the hash
  12. // or if already redirected form itself, do nothing
  13. if (!redirectedHash || to.query.search || to.params.type) return
  14. const search = redirectedHash.slice('#search/'.length)
  15. return {
  16. name: 'SearchOverview',
  17. // probably a ticket, but can be anything
  18. params: { type: 'ticket' },
  19. query: { search },
  20. }
  21. },
  22. meta: {
  23. title: __('Search'),
  24. requiresAuth: true,
  25. requiredPermission: ['ticket.agent', 'ticket.customer'],
  26. hasBottomNavigation: true,
  27. level: 3,
  28. },
  29. },
  30. ]
  31. export default routes