mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
docs(api): add key
option for useFetch
(#5089)
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
This commit is contained in:
parent
aace553f1a
commit
7b3dc6ec5d
@ -11,6 +11,7 @@ function useFetch(
|
||||
): Promise<DataT>
|
||||
|
||||
type UseFetchOptions = {
|
||||
key?: string,
|
||||
method?: string,
|
||||
params?: SearchParams,
|
||||
body?: RequestInit['body'] | Record<string, any>
|
||||
@ -41,6 +42,7 @@ type DataT = {
|
||||
* `headers`: Request headers
|
||||
* `baseURL`: Base URL for the request
|
||||
* **Options (from `useAsyncData`)**:
|
||||
* `key`: a unique key to ensure that data fetching can be properly de-duplicated across requests, if not provided, it will be generated based on the `url` and fetch options
|
||||
* `lazy`: Whether to resolve the async function after loading the route, instead of blocking navigation (defaults to `false`).
|
||||
* `server`: Whether to fetch the data on the server (defaults to `true`).
|
||||
* `default`: A factory function to set the default value of the data, before the async function resolves - particularly useful with the `lazy: true` option.
|
||||
|
Loading…
Reference in New Issue
Block a user