routes.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. import type { RouteRecordRaw } from 'vue-router'
  3. export const isMainRoute = true
  4. const route: RouteRecordRaw[] = [
  5. {
  6. path: '/login',
  7. name: 'Login',
  8. component: () => import('./views/Login.vue'),
  9. meta: {
  10. title: __('Sign in'),
  11. requiresAuth: false,
  12. requiredPermission: null,
  13. hasOwnLandmarks: true,
  14. },
  15. },
  16. {
  17. path: '/logout',
  18. name: 'Logout',
  19. component: {
  20. async beforeRouteEnter() {
  21. const [{ useAuthenticationStore }, { useNotifications }] =
  22. await Promise.all([
  23. import('@shared/stores/authentication'),
  24. import('@shared/components/CommonNotifications/composable'),
  25. ])
  26. const { clearAllNotifications } = useNotifications()
  27. const authentication = useAuthenticationStore()
  28. clearAllNotifications()
  29. await authentication.logout()
  30. if (authentication.externalLogout) return false
  31. return '/login'
  32. },
  33. },
  34. meta: {
  35. requiresAuth: false,
  36. requiredPermission: null,
  37. },
  38. },
  39. ]
  40. export default route