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