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

Is Axios interceptors available through Typesense.Client? #223

Open
henriksjodahl opened this issue Aug 20, 2024 · 2 comments
Open

Is Axios interceptors available through Typesense.Client? #223

henriksjodahl opened this issue Aug 20, 2024 · 2 comments

Comments

@henriksjodahl
Copy link

Description

I’m working on using typesense-js in a Nuxt application, and I have the goal to manage access to my data by rotating and scoping API-keys through my backend with a fixed ttl. But I'm looking for a way to easily capture any old keys and refreshing them by looking for 401-exceptions through the API. Since you’re using axios I assumed I could use Axios interceptors in a way, but looking through the code i cant seem to find a way to do that. Am I missing something, or is there actually no way to pass interceptors down to the Axios client inside Typesense.Client?

Expected Behavior

A way to pass Axios Interceptors through the Typesense Client.

Actual Behavior

There seem to be no way to pass down Axios Interceptors through the Typesense Client.

@jasonbosco
Copy link
Member

There is no way to pass interceptors to the axios instance used by typesense-js.

However, you should be able to use global interceptors as described here: https://axios-http.com/docs/interceptors

@henriksjodahl
Copy link
Author

Thanks for the reply!

I've tried this, but from what I've read, I don't think global interceptors are automatically copied over when a new Axios-instance is created. I can't seem to get them registered within the TypeSense Axios-instance at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants