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
Access Operation inside isTokenValidOrUndefined and handleFetch/handleError #48
Comments
hi, @justenau , could you please make a PR? |
Hello again, @justenau , I've changed an order of arguments a bit to make it less breaking changer and published new version. could you please verify that it still works for you? and thanks for contibution |
Works as a charm, thank you for such a quick collaboration! |
I think I've already updated README. thanks) |
@kharithomas I looked at #50 and it seems you run into an identical situation as I had so here's an example how to solve it by using
Basically this I think we could update |
@justenau Okay that makes a lot more sense - thanks! |
@justenau I'd like to ask one more clarifying question. I decided to convert my setup to use React Redux & Redux Toolkit. Usually w/ Redux we create a store then access is directly using Here, it seems
Is there an additional step needed? It's not explicitly mentioned, but how do we specify our Redux store in the apollo-link-token-refresh setup? |
@kharithomas Very common practice in Redux is to wrap the As far as I can see from your example you already have your store accessible if you can import it that easily from |
Thanks for the quick reply. And yes, that's how I've set mine up.
For this reason, I am also wondering if the additional complexity provides any additional benefits that just directly accessing the store. |
Hmm, then it's weird that you cannot access |
Update* my configuration of Redux was incorrect - accessing the store directly instead of through Original message: Right, but I can confirm that this setup isn't working. Seems the dispatch isn't getting called correctly from here. I might be able to put together an example on code sandbox to demo |
Hi @justenau @kharithomas , My Redux Provider config is same as here. cc: @newsiberian |
When using this library we ran into issue of not being able to access Redux state or dispatch actions inside the
TokenRefreshLink
becauseOperation
was not accessible inside of it. We had to tweek it a bit so that these functions would passOperation
object.I believe this use case is quite common because if we store
accessToken
inside Redux and after refreshing it want to change the state, there's no possible way to that without having access to context.This requires minimal changes to the existing code though helps a lot, so it would be nice to have this functionality as part of this library.
The text was updated successfully, but these errors were encountered: