mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
docs: fix api examples (#4870)
This commit is contained in:
parent
b633a9c106
commit
c0f0670ad7
@ -182,7 +182,7 @@ The example below adds the request headers to an isomorphic `fetch` call to ensu
|
||||
|
||||
```vue
|
||||
<script setup>
|
||||
const { data } = useFetch('/api/me', {
|
||||
const { data } = await useFetch('/api/me', {
|
||||
headers: useRequestHeaders(['cookie'])
|
||||
})
|
||||
</script>
|
||||
|
@ -57,7 +57,7 @@ By default, Nuxt waits until a `refresh` is finished before it can be executed a
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const { data, pending, error, refresh } = useFetch(
|
||||
const { data, pending, error, refresh } = await useFetch(
|
||||
'https://api.nuxtjs.dev/mountains',
|
||||
{
|
||||
pick: ['title']
|
||||
|
@ -6,7 +6,7 @@ Within the template of a Vue component, you can access the route using `$route`.
|
||||
|
||||
## Example
|
||||
|
||||
In the following example, we call an API via `useAsyncData` using a dynamic page parameter - `slug` - as part of the URL.
|
||||
In the following example, we call an API via `useFetch` using a dynamic page parameter - `slug` - as part of the URL.
|
||||
|
||||
```html [~/pages/[slug].vue]
|
||||
<script setup>
|
||||
|
Loading…
Reference in New Issue
Block a user