2019-10-14 18:40:49 -04:00
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
2020-05-28 11:32:57 -04:00
|
|
|
import Controller from "@ember/controller";
|
2019-10-14 18:40:49 -04:00
|
|
|
|
2020-05-28 11:32:57 -04:00
|
|
|
export default Controller.extend({
|
2019-10-14 18:40:49 -04:00
|
|
|
actions: {
|
2019-10-22 01:35:41 -04:00
|
|
|
cancelProduct() {
|
2019-12-02 02:58:14 -05:00
|
|
|
this.transitionToRoute("adminPlugins.discourse-subscriptions.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()
|
2020-09-16 10:53:50 -04:00
|
|
|
.then((product) => {
|
2019-10-24 23:00:59 -04:00
|
|
|
this.transitionToRoute(
|
2019-12-02 02:58:14 -05:00
|
|
|
"adminPlugins.discourse-subscriptions.products.show",
|
2019-10-24 23:00:59 -04:00
|
|
|
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(() => {
|
2019-12-02 18:52:46 -05:00
|
|
|
this.transitionToRoute(
|
|
|
|
"adminPlugins.discourse-subscriptions.products"
|
|
|
|
);
|
2019-10-23 00:55:06 -04:00
|
|
|
})
|
2019-10-15 23:15:01 -04:00
|
|
|
.catch(popupAjaxError);
|
2020-09-16 10:53:50 -04:00
|
|
|
},
|
|
|
|
},
|
2019-10-14 18:40:49 -04:00
|
|
|
});
|