discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins-discourse-pat...

31 lines
723 B
Plaintext
Raw Normal View History

2019-10-14 18:40:49 -04:00
import { popupAjaxError } from "discourse/lib/ajax-error";
export default Ember.Controller.extend({
actions: {
2019-10-22 01:35:41 -04:00
cancelProduct() {
2019-10-23 00:55:06 -04:00
this.transitionToRoute("adminPlugins.discourse-patrons.products");
2019-10-22 01:35:41 -04:00
},
2019-10-15 06:50:30 -04:00
createProduct() {
this.get("model.product")
2019-10-14 18:40:49 -04:00
.save()
2019-10-23 00:55:06 -04:00
.then(product => {
2019-10-24 23:00:59 -04:00
this.transitionToRoute(
"adminPlugins.discourse-patrons.products.show",
product.id
);
2019-10-23 00:55:06 -04:00
})
2019-10-14 18:40:49 -04:00
.catch(popupAjaxError);
2019-10-15 23:15:01 -04:00
},
updateProduct() {
this.get("model.product")
.update()
2019-10-23 00:55:06 -04:00
.then(() => {
this.transitionToRoute("adminPlugins.discourse-patrons.products");
})
2019-10-15 23:15:01 -04:00
.catch(popupAjaxError);
2019-10-14 18:40:49 -04:00
}
}
});