Files

24 lines
700 B
JavaScript
Raw Permalink Normal View History

import Controller from "@ember/controller";
2024-11-29 15:42:50 +00:00
import { action } from "@ember/object";
2024-11-19 10:31:14 +00:00
import { service } from "@ember/service";
2024-01-16 17:51:44 +01:00
import { popupAjaxError } from "discourse/lib/ajax-error";
2019-10-08 15:55:38 +11:00
2024-11-29 15:42:50 +00:00
export default class AdminPluginsDiscourseSubscriptionsPlansShowController extends Controller {
@service router;
2024-11-29 15:42:50 +00:00
@action
createPlan() {
if (this.get("model.plan.product_id") === undefined) {
const productID = this.get("model.products.firstObject.id");
this.set("model.plan.product_id", productID);
}
2019-10-17 12:07:06 +11:00
2024-11-29 15:42:50 +00:00
this.get("model.plan")
.save()
.then(() => {
this.router.transitionTo("adminPlugins.discourse-subscriptions.plans");
})
.catch(popupAjaxError);
}
}