How do I "listen" to every mutation result?
May 10, 2020 at 8:04pmHow do I "listen" to every mutation result?
May 10, 2020 at 8:04pmI want to see if there is a specific property or node type returned by the server, and if so, update my state.
The manual way would be to after every mutation call pass the returned data to my
DoSomethingIfMutationHasXService
.
Is there a solution that is less cumbersome?I was thinking about somehow listening to each mutation result in the service itself.
Any ideas? How would you go about doing that? :)
May 10, 2020 at 9:19pm
const yourLink = new ApolloLink((operation, forward) => {return forward(operation).map((result) => {const { data, errors } = result// do whatever with the resultreturn result;})});
June 9, 2020 at 10:32pm