Composables

useLazy[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 useLazyFetch.

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

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

Copyright © 2024