redux-query icon indicating copy to clipboard operation
redux-query copied to clipboard

Accessing store in network interface

Open thomasleese opened this issue 5 years ago • 0 comments

In our application we store JWT access and refresh tokens for the user in the store. We need this information to perform the network request. Getting the access token is fairly simple, we can use middleware as discussed in https://github.com/amplitude/redux-query/issues/120 but if the access token has timed out, we would want to get a new one using the refresh token (by performing an extra API call) and then update the store with the new token.

As far as I can tell, I don't think it's currently possible to call dispatch from the network interface (which is what we currently use to update the access token if it has been refreshed).

I was thinking of opening a PR for this, but I thought I would open an issue first to see if you had any thoughts on how to implement this an alternative way (I can see that adding the store into the network interface blurs the lines between it and the middleware).

thomasleese avatar Jan 22 '20 06:01 thomasleese