const client = new ApolloClient({
cache: new InMemoryCache({ possibleTypes }),
link: from([authLink,refreshTokenLink,httpLink, errorLink]),
});
This is my apollo code and on these these link: from([authLink,refreshTokenLink,httpLink]) are working fine on adding errorLink that is not calling. Also tried with concat and change the array values but it's not working also let me know if there is any working example.
httpLink
is a "terminal link" - it won't call any link behind it. So ordering is important here!Move your
errorLink
before thehttpLink
- generally, a link can only see the results of what comes behind it, so it wouldn't be useful at the end.With your current odering, it goes
authLink
callsrefreshTokenLink
(can pass things intorefreshTokenLink
andhttpLink
and see what they return)refreshTokenLink
callshttpLink
(can pass things intohttpLink
and see what it returns)httpLink
makes a request and returns the result.You need to go
because for the errorLink to be any useful, it needs to see the errors returned from the
httpLink
.