diff --git a/package.json b/package.json index 97a64cdb2..cde8e1cb6 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "apollo-link": "^1.0.7", "apollo-link-error": "^1.0.3", "apollo-link-http": "^1.3.2", + "apollo-link-logger": "^1.1.0", "apollo-link-schema": "^1.0.1", "bluebird": "^3.5.1", "body-parser": "^1.18.2", diff --git a/src/core/createApolloClient/createApolloClient.client.js b/src/core/createApolloClient/createApolloClient.client.js index a85e0e3fd..0afa72727 100644 --- a/src/core/createApolloClient/createApolloClient.client.js +++ b/src/core/createApolloClient/createApolloClient.client.js @@ -4,6 +4,7 @@ import { ApolloClient } from 'apollo-client'; import { from } from 'apollo-link'; import { onError } from 'apollo-link-error'; import { HttpLink } from 'apollo-link-http'; +import apolloLogger from 'apollo-link-logger'; import createCache from './createCache'; const link = from([ @@ -16,6 +17,7 @@ const link = from([ ); if (networkError) console.warn(`[Network error]: ${networkError}`); }), + ...(__DEV__ ? [apolloLogger] : []), new HttpLink({ uri: '/graphql', credentials: 'include', diff --git a/yarn.lock b/yarn.lock index 4373c752b..bb1c561d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -884,6 +884,10 @@ apollo-link-http@^1.3.2: dependencies: apollo-link "^1.0.7" +apollo-link-logger@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/apollo-link-logger/-/apollo-link-logger-1.1.0.tgz#5f2220e5c0c6ebbaf6161a25921142fdb824efce" + apollo-link-schema@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/apollo-link-schema/-/apollo-link-schema-1.0.1.tgz#d9db6343b1512373cc847188b5fb8708abd6235a"