useBaseUrl.ts 505 B

123456789101112131415161718192021
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { computed } from 'vue'
  3. import { useApplicationStore } from '#shared/stores/application.ts'
  4. export const useBaseUrl = () => {
  5. const application = useApplicationStore()
  6. const baseUrl = computed(() => {
  7. const { http_type: httpType, fqdn } = application.config
  8. if (!fqdn || fqdn === 'zammad.example.com') return window.location.origin
  9. return `${httpType}://${fqdn}`
  10. })
  11. return {
  12. baseUrl,
  13. }
  14. }