2026-01-02 13:41:09 +00:00
|
|
|
// Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/
|
2022-06-21 11:35:24 +00:00
|
|
|
|
2026-01-19 09:35:47 +00:00
|
|
|
import { toRef, unref } from 'vue'
|
2024-05-17 13:31:19 +00:00
|
|
|
|
2023-04-24 12:50:55 +00:00
|
|
|
import { useApplicationStore } from '#shared/stores/application.ts'
|
|
|
|
|
import type { ConfigList } from '#shared/types/store.ts'
|
2024-05-17 13:31:19 +00:00
|
|
|
|
2022-07-20 14:41:44 +00:00
|
|
|
import type { App } from 'vue'
|
2022-06-21 11:35:24 +00:00
|
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
|
export interface ComponentCustomProperties {
|
|
|
|
|
$c: ConfigList
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const applicationConfigPlugin = (app: App) => {
|
|
|
|
|
const application = useApplicationStore()
|
2026-01-19 09:35:47 +00:00
|
|
|
const config = toRef(application, 'config')
|
2022-06-21 11:35:24 +00:00
|
|
|
|
|
|
|
|
Object.defineProperty(app.config.globalProperties, '$c', {
|
|
|
|
|
enumerable: true,
|
|
|
|
|
get: () => unref(config),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default applicationConfigPlugin
|