mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
Fix flow error
This commit is contained in:
parent
a570b3c1f8
commit
eb0faa011e
@ -89,15 +89,14 @@ class GraphQLEditor extends React.PureComponent {
|
|||||||
schemaIsFetching: false
|
schemaIsFetching: false
|
||||||
};
|
};
|
||||||
|
|
||||||
let request: RenderedRequest;
|
let request: RenderedRequest | null = null;
|
||||||
try {
|
try {
|
||||||
request = await getRenderedRequest(rawRequest, environmentId);
|
request = await getRenderedRequest(rawRequest, environmentId);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
newState.schemaFetchError = `Failed to fetch schema: ${err}`;
|
newState.schemaFetchError = `Failed to fetch schema: ${err}`;
|
||||||
this.setState(newState);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (request) {
|
||||||
try {
|
try {
|
||||||
// TODO: Use Insomnia's network stack to handle things like authentication
|
// TODO: Use Insomnia's network stack to handle things like authentication
|
||||||
const bodyJson = JSON.stringify({query: introspectionQuery});
|
const bodyJson = JSON.stringify({query: introspectionQuery});
|
||||||
@ -135,6 +134,7 @@ class GraphQLEditor extends React.PureComponent {
|
|||||||
console.warn(`Failed to fetch GraphQL schema from ${request.url}`, err);
|
console.warn(`Failed to fetch GraphQL schema from ${request.url}`, err);
|
||||||
newState.schemaFetchError = `Failed to contact "${request.url}" to fetch schema`;
|
newState.schemaFetchError = `Failed to contact "${request.url}" to fetch schema`;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this._isMounted) {
|
if (this._isMounted) {
|
||||||
this.setState(newState);
|
this.setState(newState);
|
||||||
|
Loading…
Reference in New Issue
Block a user