Fix ajax callbacks after javascript conversion

This commit is contained in:
Piotr Sarnacki 2015-12-29 12:49:18 +01:00
parent ece4141cc5
commit 737685a7c0
2 changed files with 5 additions and 5 deletions

View File

@ -212,7 +212,7 @@ export default Ember.Component.extend({
toggleTailing() { toggleTailing() {
Travis.tailing.toggle(); Travis.tailing.toggle();
this.engine.autoCloseFold = !Travis.tailing.isActive(); this.engine.autoCloseFold = !Travis.tailing.isActive();
return event.preventDefault(); return false;
}, },
removeLogPopup() { removeLogPopup() {

View File

@ -77,17 +77,17 @@ export default Ember.Service.extend({
options.contentType = options.contentType || 'application/json; charset=utf-8'; options.contentType = options.contentType || 'application/json; charset=utf-8';
} }
success = options.success || (function() {}); success = options.success || (function() {});
options.success = () => { options.success = (body, status, xhr) => {
if (data != null ? data.flash : void 0) { if (data != null ? data.flash : void 0) {
Travis.lookup('controller:flash').loadFlashes(data.flash); Travis.lookup('controller:flash').loadFlashes(data.flash);
} }
if (data != null) { if (data != null) {
delete data.flash; delete data.flash;
} }
return success.apply(this, arguments); return success.call(this, body, status, xhr);
}; };
error = options.error || function() {}; error = options.error || function() {};
options.error = () => { options.error = (body, status, xhr) => {
console.log("[ERROR] API responded with an error (" + status + "): " + (JSON.stringify(data))); console.log("[ERROR] API responded with an error (" + status + "): " + (JSON.stringify(data)));
if (data != null ? data.flash : void 0) { if (data != null ? data.flash : void 0) {
Travis.lookup('controller:flash').pushObject(data.flash); Travis.lookup('controller:flash').pushObject(data.flash);
@ -95,7 +95,7 @@ export default Ember.Service.extend({
if (data != null) { if (data != null) {
delete data.flash; delete data.flash;
} }
return error.apply(this, arguments); return error.call(this, body, status, xhr);
}; };
options = $.extend(options, default_options); options = $.extend(options, default_options);