@automattic/vip
Advanced tools
Comparing version 1.4.0-dev3 to 1.4.0-dev4
@@ -44,9 +44,17 @@ "use strict"; | ||
const unauthorizedLink = (0, _apolloLinkError.onError)(({ | ||
networkError | ||
const errorLink = (0, _apolloLinkError.onError)(({ | ||
networkError, | ||
graphQLErrors | ||
}) => { | ||
if (networkError.statusCode === 401) { | ||
if (networkError && networkError.statusCode === 401) { | ||
console.error(_chalk.default.red('Unauthorized:'), 'You are unauthorized to perform this request, please logout with `vip logout` then try again.'); | ||
process.exit(); | ||
} | ||
if (graphQLErrors && graphQLErrors.length) { | ||
graphQLErrors.forEach(error => { | ||
console.error(_chalk.default.red('Error:'), error.message); | ||
}); | ||
process.exit(); | ||
} | ||
}); | ||
@@ -58,5 +66,5 @@ const httpLink = new _apolloLinkHttp.HttpLink({ | ||
return new _apolloClient.ApolloClient({ | ||
link: unauthorizedLink.concat(httpLink), | ||
link: errorLink.concat(httpLink), | ||
cache: new _apolloCacheInmemory.InMemoryCache() | ||
}); | ||
} |
{ | ||
"name": "@automattic/vip", | ||
"version": "1.4.0-dev3", | ||
"version": "1.4.0-dev4", | ||
"description": "The VIP Go Javascript library & CLI", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70198
1823