23 lines
529 B
TypeScript
23 lines
529 B
TypeScript
import { ref } from 'vue'
|
|
import { defineStore } from 'pinia'
|
|
import { getTenantConfig } from '@/config/app-config'
|
|
|
|
export const useConfigStore = defineStore('config', () => {
|
|
const config = ref<Record<string, any> | null>(null)
|
|
|
|
function hydrateFromAppConfig() {
|
|
const tenant = getTenantConfig()
|
|
config.value = tenant && Object.keys(tenant).length > 0 ? tenant : null
|
|
}
|
|
|
|
async function getConfigData() {
|
|
hydrateFromAppConfig()
|
|
}
|
|
|
|
return {
|
|
config,
|
|
hydrateFromAppConfig,
|
|
getConfigData,
|
|
}
|
|
})
|