feedback error when plan creates and updates

This commit is contained in:
Rimian Perkins 2019-10-31 12:41:02 +11:00
parent ced4d1c786
commit 1074d84901
2 changed files with 9 additions and 3 deletions

View File

@ -33,13 +33,19 @@ export default Ember.Controller.extend({
this.get("model.plan")
.save()
.then(() => this.redirect(this.productId));
.then(() => this.redirect(this.productId))
.catch(data =>
bootbox.alert(data.jqXHR.responseJSON.errors.join("\n"))
);
},
updatePlan() {
this.get("model.plan")
.update()
.then(() => this.redirect(this.productId));
.then(() => this.redirect(this.productId))
.catch(data =>
bootbox.alert(data.jqXHR.responseJSON.errors.join("\n"))
);
}
}
});

View File

@ -34,7 +34,7 @@ Subscription.reopenClass({
return ajax("/patrons/subscriptions", { method: "get" }).then(result =>
result.map(subscription => {
subscription.plan = Plan.create(subscription.plan);
return Subscription.create(subscription)
return Subscription.create(subscription);
})
);
}