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.
httpLinkis a "terminal link" - it won't call any link behind it. So ordering is important here!Move your
errorLinkbefore 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
authLinkcallsrefreshTokenLink(can pass things intorefreshTokenLinkandhttpLinkand see what they return)refreshTokenLinkcallshttpLink(can pass things intohttpLinkand see what it returns)httpLinkmakes 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.