export function useAppVersion() {
    const api = useApi()
    const version = useState<string | null>('app-version', () => null)

    async function load(): Promise<string | null> {
        if (version.value) {
            return version.value
        }
        const response = await api.get<{ version: string }>('version', {}, {
            toast: false
        })
        version.value = response.version
        return version.value
    }

    return { version, load }
}
