discourse/app/assets/javascripts/admin/controllers/admin-email-advanced-test.js.es6
2019-05-27 10:15:39 +02:00

31 lines
663 B
JavaScript

import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
export default Ember.Controller.extend({
email: null,
text: null,
elided: null,
format: null,
loading: null,
actions: {
run() {
this.set("loading", true);
ajax("/admin/email/advanced-test", {
type: "POST",
data: { email: this.email }
})
.then(data => {
this.setProperties({
text: data.text,
elided: data.elided,
format: data.format
});
})
.catch(popupAjaxError)
.finally(() => this.set("loading", false));
}
}
});