2026-08-11 22:06:10 +03:30
|
|
|
import { ref } from 'vue'
|
|
|
|
|
import { defineStore } from 'pinia'
|
|
|
|
|
import { getTenantConfig } from '@/config/app-config'
|
2026-08-01 10:11:28 +03:30
|
|
|
|
|
|
|
|
export const useConfigStore = defineStore('config', () => {
|
2026-08-11 22:06:10 +03:30
|
|
|
const config = ref<Record<string, any> | null>(null)
|
2026-08-01 10:11:28 +03:30
|
|
|
|
2026-08-11 22:06:10 +03:30
|
|
|
function hydrateFromAppConfig() {
|
|
|
|
|
const tenant = getTenantConfig()
|
|
|
|
|
config.value = tenant && Object.keys(tenant).length > 0 ? tenant : null
|
|
|
|
|
}
|
2026-08-01 10:11:28 +03:30
|
|
|
|
2026-08-11 22:06:10 +03:30
|
|
|
async function getConfigData() {
|
|
|
|
|
hydrateFromAppConfig()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
config,
|
|
|
|
|
hydrateFromAppConfig,
|
|
|
|
|
getConfigData,
|
|
|
|
|
}
|
2026-08-01 10:11:28 +03:30
|
|
|
})
|