Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors on boot #93

Merged
merged 3 commits into from
Oct 23, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Provide more help
gjtorikian committed Oct 23, 2017

Unverified

This user has not yet uploaded their public signing key.
commit a311733538320ec485083a69f47b6eab1a6e82eb
17 changes: 15 additions & 2 deletions app/components/App.js
Original file line number Diff line number Diff line change
@@ -154,6 +154,15 @@ export default class App extends React.Component {
'Content-Type': 'application/json'
};

const error = {
"data" : null,
"errors": [
{
"message": "I couldn't communicate with the GraphQL server at the provided URL. Is it correct?"
}
]
};

const { endpoint, method, headers } = this.getCurrentTab();

if (endpoint == "") {
@@ -167,6 +176,8 @@ export default class App extends React.Component {
});
}



if (method == "get") {
var url = endpoint;
if (typeof graphQLParams['variables'] === "undefined"){
@@ -180,14 +191,16 @@ export default class App extends React.Component {
credentials: 'include',
headers: Object.assign({}, defaultHeaders, headers),
body: null
}).then(response => response.json());
}).then(response => response.json())
.catch(reason => error);
}
return fetch(endpoint, {
method: method,
credentials: 'include',
headers: Object.assign({}, defaultHeaders, headers),
body: JSON.stringify(graphQLParams)
}).then(response => response.json());
}).then(response => response.json())
.catch(reason => error);
}

handleChange(field, eOrKey, e) {