Redux createApi-prepareHeaders #3283
Replies: 3 comments 1 reply
-
Are you maybe trying to do an api request before |
Beta Was this translation helpful? Give feedback.
-
You right!, I tried to console log each step of the auth componnent, I guess that it happend because in this project all the auth logic is on react context the redux provider wrap the whole componnent and the AuthProvider is the next in the tree. I solved my problem with asyncThunk (because I use useEffect to first dispatch it), but it semms that createApi is actullay really good tool because of the auto caching, and I really want to use it but i dont know how I can call the auth logic before the createApi, (maybe handling my auth logic with createApi). Can I solve this problem in other way ? David |
Beta Was this translation helpful? Give feedback.
-
Hey, Sorry I forgot to update. I've fixed it in some way (maybe not the best but its working :D ) Just by creating prepareHeaders function, and calling a promise
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey I'm implmenting Redux to my project. I want to use for API calls the new createApi tool for it.
Its working but I have one issue, when I reload the page the token that is passed via Redux is null (The login machanizem isn't working with Redux createApi), when I navigate to other routes and I return to the createApi route it fetching the data. (I also verify that via console.logging the token)
In Store
Im Profile for testing
When I refreshing I only get
<p>error</p>
, when I reload or go to other path and return the Profile path I get the data.Beta Was this translation helpful? Give feedback.
All reactions