UNPKG

nuxt-kql

Version:

Kirby's Query Language API for Nuxt

23 lines (22 loc) 1.16 kB
import type { NitroFetchOptions } from 'nitropack'; import type { AsyncData, AsyncDataOptions, NuxtError } from 'nuxt/app'; import type { MaybeRefOrGetter, MultiWatchSources } from 'vue'; type UseKirbyDataOptions<T> = Omit<AsyncDataOptions<T>, 'watch'> & Pick<NitroFetchOptions<string>, 'onRequest' | 'onRequestError' | 'onResponse' | 'onResponseError' | 'query' | 'headers' | 'method' | 'body' | 'retry' | 'retryDelay' | 'retryStatusCodes' | 'timeout'> & { /** * Language code to fetch data for in multi-language Kirby setups. */ language?: MaybeRefOrGetter<string>; /** * Cache the response between function calls for the same path. * @default true */ cache?: boolean; /** * Watch an array of reactive sources and auto-refresh the fetch result when they change. * Path and language are watched by default. You can completely ignore reactive sources by using `watch: false`. * @default undefined */ watch?: MultiWatchSources | false; }; export declare function useKirbyData<T = any>(path: MaybeRefOrGetter<string>, opts?: UseKirbyDataOptions<T>): AsyncData<T | null, NuxtError>; export {};