Defaults
Default options for Nuxt API Party $myApi
composables can be set in a Nuxt plugin. It should provide the apiParty
key with a defaults
and/or endpoints.[endpointId].defaults
object.
defaults
defines global defaults used for all endpointsendpoints.[endpointId].defaults
defines defaults for a specific endpoint (overrides global defaults)
The type ModulePlugin
is provided as a convenience to ensure your plugin provides the correct defaults.
Inheritance
The useApiData
composables will also use these defaults, as well as the relevant Nuxt configuration set in experimental.defaults
.
Minimal Example Plugin
ts
import type { ModulePlugin as APIPartyPlugin } from 'nuxt-api-party'
export default defineNuxtPlugin(() => {
return {
provide: {
apiParty: {
defaults: {
// ...
},
endpoints: {
[endpointId]: {
defaults: {
// ...
}
}
}
}
}
}
}) satisfies APIPartyPlugin