import type { ICountries } from '../../types'; import type { Language } from '../../runtime'; import { AsyncData } from '../../runtime'; export const useFetchDictionariesCountries = async ( apiMethod: (...args: any[]) => Promise ) => { const lang = useLang() as Language; const key = AsyncData.Countries; const stateKey = computed(() => `data-${key}-${lang}`); const { data, status, error } = await useAsyncData( key, () => useApiFetcher( stateKey.value, apiMethod, lang, )(), ); return { countriesData: data, status, error }; };