-
-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Describe the feature
As of nuxt 3.14, using a function for the schema prints this to console.
WARN Runtime config option apiParty.endpoints.foo.schema may not be able to be serialized.
I suggest using a hook that can update the endpoint. Hooks could also be added to intercept the API requests. Adding authorization, extra headers, request filtering, etc.
It would be used similarly to this.
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['nuxt-api-party'],
apiParty: {
endpoints: {
foo: {
url: 'http://localhost:8000'
}
}
},
// new hooks used instead of function
hooks: {
'api-party:resolve': async (id, endpoint) => {
// set the schema value
endpoint.schema = {
// TODO
}
},
}
})Additional possible hooks
// plugins/api-auth.ts
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hooks.hook('api-party:fetch', async (request, {event}) => {
// TODO
})
})// server/plugins/api-auth.ts
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('api-party:request', async (request, {event}) => {
// TODO
})
})Additional information
- Would you be willing to help implement this feature?
- Can you think of other implementations of this feature?
Final checks
- Check existing issues.
johannschopplich
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request