Skip to content

Commit f97b0a6

Browse files
committed
feat: don't who graphql errors on production
1 parent f8fbc6c commit f97b0a6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/plugin.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function maybeFetchEnv(uri, env) {
6060
}
6161

6262
function createClient({
63-
link, store, queries, mutations, env
63+
link, store, queries, mutations, env,
6464
}) {
6565
const splitLink = ApolloLink.split(
6666
() => process.server,
@@ -101,7 +101,9 @@ function createClient({
101101
resolve({ data: data.data, errors: [] });
102102
})
103103
.catch((errors) => {
104-
console.error(errors); // eslint-disable-line
104+
if (!process.env.NODE_ENV === 'production') {
105+
console.error(errors); // eslint-disable-line
106+
}
105107
resolve({ data: {}, errors: errors.graphQLErrors });
106108
});
107109
});
@@ -162,8 +164,8 @@ export default ({ store, env }, inject) => {
162164
const mutations = require('<%= options.graphqlFolder %>/mutations').default;
163165

164166
const {
165-
query, q, mutate, m
166-
} = createClient({
167+
query, q, mutate, m,
168+
} = createClient({
167169
store,
168170
queries,
169171
mutations,

0 commit comments

Comments
 (0)