Defaults
Set default options for Nuxt API Party $myApi composables in a Nuxt plugin. Provide the apiParty key with a defaults and/or endpoints.[endpointId].defaults object.
defaultsdefines global defaults for all endpointsendpoints.[endpointId].defaultsdefines defaults for a specific endpoint (overrides global defaults)
The ModulePlugin type ensures your plugin provides correct defaults.
Inheritance
The useApiData composables also use these defaults, as well as 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