diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js index b87e7273..32eeeb2c 100644 --- a/app/assets/javascripts/admin.js +++ b/app/assets/javascripts/admin.js @@ -17,17 +17,19 @@ $(document).on('turbolinks:load', function() { }); $("#collaborators-query").on("input", function() { - const xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { - eval(xhr.responseText); + req = `/admin/publications/collaborators?collaborators_query=${ + $("#collaborators-query").val() + }` + + fetch(req, { headers: { "X-Requested-With": "XMLHttpRequest" } }).then(response => { + if (response.status == 200) { + return response.text(); + } else { + return Promise.reject( + new Error(`Invalid response status code ${response.status} for request ${req}`) + ); } - }; - xhr.open( - "GET", - "/admin/publications/collaborators?collaborators_query=" + $("#collaborators-query").val(), true - ); - xhr.send(); + }).then(text => eval(text)); }); $("#commit").click(function() { diff --git a/config/secrets.yml b/config/secrets.yml index 78d5753d..fe52fc8b 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -86,7 +86,6 @@ production: sentry: dsn: <%= ENV['SENTRY_DSN'] %> release: <%= ENV['RELEASE_VERSION'] %> - aws: aws: s3: region: <%= ENV['AWS_S3_REGION'] %>