diff --git a/assets/javascripts/discourse/components/query-result.js.es6 b/assets/javascripts/discourse/components/query-result.js.es6 index 3dbcb73..85b9d6a 100644 --- a/assets/javascripts/discourse/components/query-result.js.es6 +++ b/assets/javascripts/discourse/components/query-result.js.es6 @@ -1,4 +1,4 @@ - +import { ajax } from 'discourse/lib/ajax'; import Badge from 'discourse/models/badge'; function randomIdShort() { @@ -147,7 +147,7 @@ const QueryResultComponent = Ember.Component.extend({ addInput('explain', this.get('hasExplain')); addInput('limit', '1000000'); - Discourse.ajax('/session/csrf.json').then(function(csrf) { + ajax('/session/csrf.json').then(function(csrf) { addInput('authenticity_token', csrf.csrf); document.body.appendChild(form); diff --git a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 index c4cad7e..56b2a29 100644 --- a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 @@ -1,6 +1,7 @@ import showModal from 'discourse/lib/show-modal'; import Query from 'discourse/plugins/discourse-data-explorer/discourse/models/query'; import { popupAjaxError } from 'discourse/lib/ajax-error'; +import { ajax } from 'discourse/lib/ajax'; const NoQuery = Query.create({name: "No queries", fake: true}); @@ -160,7 +161,7 @@ export default Ember.ArrayController.extend({ this.set('loading', true); this.set('showResults', false); - Discourse.ajax("/admin/plugins/explorer/queries/" + this.get('selectedItem.id') + "/run", { + ajax("/admin/plugins/explorer/queries/" + this.get('selectedItem.id') + "/run", { type: "POST", data: { params: JSON.stringify(this.get('selectedItem.params')), diff --git a/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 b/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 index fb19a66..34b1a63 100644 --- a/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 +++ b/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 @@ -1,3 +1,4 @@ +import { ajax } from 'discourse/lib/ajax'; export default Discourse.Route.extend({ controllerName: 'admin-plugins-explorer', @@ -5,7 +6,7 @@ export default Discourse.Route.extend({ model() { const p1 = this.store.findAll('query'); - const p2 = Discourse.ajax('/admin/plugins/explorer/schema.json', {cache: true}); + const p2 = ajax('/admin/plugins/explorer/schema.json', {cache: true}); return p1.then(model => { model.forEach(query => query.markNotDirty());