import { ref, onUnmounted } from 'vue'
import { queryConfig } from '@/services/api/common'

export function getConfigValue(configid: number) {
    const configValue = ref('')

    const controller = new AbortController()

    // 获取配置项
    queryConfig({
        controller,
        data: { configid }
    }).then((res) => {
        configValue.value = res.data.configvalue
    })

    onUnmounted(() => controller.abort())

    return configValue
}