© 2026 Hedgehog Software, LLC
useFetch
data
null
import type { UseFetchOptions } from "nuxt/app" export function useAPI<T>( url: string | (() => string), options?: Omit<UseFetchOptions<T>, "default"> & { default: () => T | Ref<T> }, ) { return useFetch(url, { ...options, $fetch: useNuxtApp().$api, }) } type MyReturnType = { data: string } const { data: a } = await useFetch<MyReturnType>("/api/url") // ^? const { data: b } = await useAPI<MyReturnType>("/api/url") // ^?
ReturnType<typeof useFetch>
Ref<T | null>