This commit is contained in:
@@ -1,26 +1,22 @@
|
||||
var initParameters = {};
|
||||
var entrypoint = null;
|
||||
|
||||
function onEditQuery(newQuery)
|
||||
{
|
||||
function onEditQuery(newQuery) {
|
||||
initParameters.query = newQuery;
|
||||
updateURL();
|
||||
}
|
||||
|
||||
function onEditVariables(newVariables)
|
||||
{
|
||||
function onEditVariables(newVariables) {
|
||||
initParameters.variables = newVariables;
|
||||
updateURL();
|
||||
}
|
||||
|
||||
function onEditOperationName(newOperationName)
|
||||
{
|
||||
function onEditOperationName(newOperationName) {
|
||||
initParameters.operationName = newOperationName;
|
||||
updateURL();
|
||||
}
|
||||
|
||||
function updateURL()
|
||||
{
|
||||
function updateURL() {
|
||||
var newSearch = '?' + Object.keys(initParameters).filter(function (key) {
|
||||
return Boolean(initParameters[key]);
|
||||
}).map(function (key) {
|
||||
@@ -29,8 +25,7 @@ function updateURL()
|
||||
history.replaceState(null, null, newSearch);
|
||||
}
|
||||
|
||||
function graphQLFetcher(graphQLParams)
|
||||
{
|
||||
function graphQLFetcher(graphQLParams) {
|
||||
return fetch(entrypoint, {
|
||||
method: 'post',
|
||||
headers: {
|
||||
@@ -50,7 +45,7 @@ function graphQLFetcher(graphQLParams)
|
||||
});
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
window.onload = function() {
|
||||
var data = JSON.parse(document.getElementById('graphiql-data').innerText);
|
||||
entrypoint = data.entrypoint;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user