mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 15:42:09 +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
|
```vue
|
||||||
<script setup>
|
<script setup>
|
||||||
const { data } = useFetch('/api/me', {
|
const { data } = await useFetch('/api/me', {
|
||||||
headers: useRequestHeaders(['cookie'])
|
headers: useRequestHeaders(['cookie'])
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -57,7 +57,7 @@ By default, Nuxt waits until a `refresh` is finished before it can be executed a
|
|||||||
## Example
|
## Example
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const { data, pending, error, refresh } = useFetch(
|
const { data, pending, error, refresh } = await useFetch(
|
||||||
'https://api.nuxtjs.dev/mountains',
|
'https://api.nuxtjs.dev/mountains',
|
||||||
{
|
{
|
||||||
pick: ['title']
|
pick: ['title']
|
||||||
|
@ -6,7 +6,7 @@ Within the template of a Vue component, you can access the route using `$route`.
|
|||||||
|
|
||||||
## Example
|
## 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]
|
```html [~/pages/[slug].vue]
|
||||||
<script setup>
|
<script setup>
|
||||||
|
Loading…
Reference in New Issue
Block a user