New: Manual search shows error when download fails

pull/2/head
Mark McDowall 9 years ago
parent 6b9c4af591
commit b34879b4f6

@ -14,15 +14,23 @@ module.exports = Backgrid.Cell.extend({
var self = this; var self = this;
this.$el.html('<i class="icon-sonarr-spinner fa-spin" />'); this.$el.html('<i class="icon-sonarr-spinner fa-spin" title="Adding to download queue" />');
//Using success callback instead of promise so it //Using success callback instead of promise so it
//gets called before the sync event is triggered //gets called before the sync event is triggered
this.model.save(null, { var promise = this.model.save(null, {
success : function() { success : function() {
self.model.set('queued', true); self.model.set('queued', true);
} }
}); });
promise.fail(function (xhr) {
if (xhr.responseJSON && xhr.responseJSON.message) {
self.$el.html('<i class="icon-sonarr-download-failed" title="{0}" />'.format(xhr.responseJSON.message));
} else {
self.$el.html('<i class="icon-sonarr-download-failed" title="Failed to add to download queue" />');
}
});
}, },
render : function() { render : function() {

Loading…
Cancel
Save