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

Non Agonisitc Interceptors #486

Open
theigwe opened this issue Oct 15, 2021 · 1 comment
Open

Non Agonisitc Interceptors #486

theigwe opened this issue Oct 15, 2021 · 1 comment

Comments

@theigwe
Copy link

theigwe commented Oct 15, 2021

How can I handle interceptors globally, having different interceptor for each driver in a multiple driver setup without having to do that in reducers?

@klis87
Copy link
Owner

klis87 commented Oct 15, 2021

I guess you mean interceptors in this context? https://redux-requests.klisiczynski.com/docs/tutorial/6-interceptors

Those interceptors are globally used, but you can use requestAction.meta.driver to have a different logic per driver.

Additionally, drivers are promised based (see how to write them - https://redux-requests.klisiczynski.com/docs/drivers/using-drivers#writing-your-own-driver), so you can just use then and catch to have some dedicated interceptors on a driver level.

If you go with driver approach, you don't need to write your own driver, you can wrap existing ones like axios driver to add your then and catch handlers

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