Skip to content

Commit

Permalink
Added alert when there is an error requesting the docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Imolorhe committed Nov 14, 2017
1 parent a6861b2 commit 8ec7109
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/app/effects/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class QueryEffects {
.setHeaders(res.data.headers)
.getIntrospectionRequest(res.data.query.url)
.catch(err => {
const errorObj = err;
const errorObj = err.error || err;
let allowsIntrospection = true;

if (errorObj.errors) {
Expand All @@ -173,6 +173,8 @@ export class QueryEffects {
// If the server does not support introspection
if (!allowsIntrospection) {
this.store.dispatch(new gqlSchemaActions.SetAllowIntrospectionAction(false, res.windowId));
} else {
this.notifyService.warning('Seems like something is broken. Please check that the URL is valid.');
}
this.store.dispatch(new docsAction.StopLoadingDocsAction(res.windowId));
return Observable.empty();
Expand Down
4 changes: 1 addition & 3 deletions src/app/services/gql.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ export class GqlService {
return this.send(introspectionQuery).map(data => {
console.log('introspection', data.data);
return data.data;
}).do(() => this.api_url = currentApiUrl).catch(err => {
return Observable.empty();
});
}).do(() => this.api_url = currentApiUrl);
}

getIntrospectionData() {
Expand Down

0 comments on commit 8ec7109

Please sign in to comment.