Exclude consoleLink from production build
This commit is contained in:
parent
846f5dcc7f
commit
d0265ce9d6
|
|
@ -44,10 +44,10 @@ export default function (uri, networkErrorCallback) {
|
|||
});
|
||||
|
||||
const errorLink = onError(({networkError, graphQLErrors, forward, operation}) => {
|
||||
// const observable = forward(operation);
|
||||
const observable = forward(operation);
|
||||
if (networkError && networkErrorCallback) {
|
||||
networkErrorCallback(networkError.statusCode);
|
||||
// return observable;
|
||||
return observable;
|
||||
}
|
||||
|
||||
if (graphQLErrors) {
|
||||
|
|
@ -63,16 +63,25 @@ export default function (uri, networkErrorCallback) {
|
|||
*/
|
||||
if (networkError && networkError.name === 'ServerParseError') {
|
||||
// workaround found here: https://github.com/apollographql/apollo-link/issues/855#issuecomment-485764697
|
||||
// return observable;
|
||||
return observable;
|
||||
}
|
||||
});
|
||||
|
||||
const composedLink = ApolloLink.from([
|
||||
let composedLink;
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
composedLink = ApolloLink.from([
|
||||
createOmitTypenameLink,
|
||||
errorLink,
|
||||
httpLink
|
||||
]);
|
||||
} else {
|
||||
composedLink = ApolloLink.from([
|
||||
consoleLink,
|
||||
createOmitTypenameLink,
|
||||
errorLink,
|
||||
httpLink
|
||||
]);
|
||||
}
|
||||
|
||||
// Create the apollo client
|
||||
return new ApolloClient({
|
||||
|
|
|
|||
Loading…
Reference in New Issue