E
E
Eugene2018-10-22 17:15:57
JavaScript
Eugene, 2018-10-22 17:15:57

How to implement call to api?

Good afternoon.
Please tell me how to correctly implement the execution of requests to the server using jwt, react, redux.
For example, we have a function for getting products "getProducts()" and as I understand it, the scheme should look something like this:
5bcdd5bbe7441864953507.jpeg
At the moment, I have implemented this behavior by writing a class that requires store(redux'a) and an action to update tokens. But these dependencies confuse me a little.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nakree, 2018-10-22
@fross

Answer:
https://github.com/axios/axios#interceptors
Implementation:
https://stackoverflow.com/questions/46759321/redux...

D
Dmitry Pacification, 2018-11-01
@dmitry_pacification

Well, they already answered about Axios, I won’t provide links for this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question