Composables

use[Client]

Generated fetch composable

Composables are generated for each OpenAPI client specified in the openFetch section of Nuxt config and provide a convenient wrapper around useFetch.

It has the same API as Nuxt's useFetch composable with additional path option, which is used to replace params in the pathname.

<script setup lang="ts">
const { 
data
} = await
usePets
('/pet/{petId}', {
path
: {
petId
: 12
} }) </script> <template> <
h1
>{{
data
?.
name
}}</
h1
>
</template>

Copyright © 2024