import type { UseFetchOptions } from "nuxt/app"; export function useAPI( endpoint: string, options?: UseFetchOptions, ) { if (!endpoint.startsWith("/")) { endpoint = `/${endpoint}` } const cfg = useRuntimeConfig() const fullUrl = `${cfg.public.backendUrl}${endpoint}` return useFetch( fullUrl, {...options} ) }