Closed videni closed 5 years ago
Why don't you store token redux state? Then you could fetch token using getState
during request interception. You could also use redux-persist to persist token store part with AsyncStorage. This I believe is much more performant than calling AsyncStorage
on each request since you don't need constantly communicate with native via bridge.
@ajanauskas , I see , thanks a lot
@ajanauskas i did try to do as you said. But things aren't working. App will not rehydrate. Have you found any solution on it.
because the user token is saved in AsyncStorage, a request can make only after the token is retrieved from AsyncStorage, right now I pass a header parameters to every action, this is very tedious.
as you know it doesn't work when set authorization header in the middleware config
how-to-send-axios-authorization-header-in-reactnative