UNPKG

@thunderstorefront/sdk

Version:

Create Nuxt extendable layer with this GitHub template.

18 lines (13 loc) 380 B
import type { Country } from '@thunderstorefront/types'; export interface UseCountryApi<TCountry = Country> { fetchCountries: () => Promise<TCountry[]>; } export function useCountryApi(): UseCountryApi { const client = useClient(); async function fetchCountries(): Promise<Country[]> { return await client('/api/countries'); } return { fetchCountries }; }