Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to merge interceptors arrays #456

Closed
1 task done
enkot opened this issue Oct 31, 2024 · 1 comment
Closed
1 task done

Add an option to merge interceptors arrays #456

enkot opened this issue Oct 31, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@enkot
Copy link

enkot commented Oct 31, 2024

Describe the feature

Currently calling $fetch.create() and then passing interceptors when calling $fetch() will override the interceptors from $fetch.create().
I suggest to add an option to merge them. It will be useful for implementing global logging or modifying global headers etc.
Example:

const $api = $fetch.create({
  baseURL: '/api',
  mergeInterceptors: true,
  onRequest: [
    ({ request }) => { console.log('[global log]', request) }
  ]
})

$api('/endpoint', {
  onRequest: [
    () => { console.log('[local log]', request)  }
  ]
})

The result:

[global log] /endpoint
[local log] /endpoint

Previous issue - #319

Additional information

  • Would you be willing to help implement this feature?
@enkot enkot added the enhancement New feature or request label Oct 31, 2024
@enkot
Copy link
Author

enkot commented Nov 5, 2024

Closed this in favor of #435

@enkot enkot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant