discourse-subscriptions/assets/javascripts/discourse/routes/subscribe-show.js

20 lines
687 B
JavaScript
Raw Normal View History

2019-12-12 19:54:32 -05:00
import Route from "@ember/routing/route";
2019-12-02 02:58:14 -05:00
import Plan from "discourse/plugins/discourse-subscriptions/discourse/models/plan";
2024-01-16 11:51:44 -05:00
import Product from "discourse/plugins/discourse-subscriptions/discourse/models/product";
import Subscription from "discourse/plugins/discourse-subscriptions/discourse/models/subscription";
2019-11-04 00:37:21 -05:00
export default class SubscribeShowRoute extends Route {
2019-11-04 00:37:21 -05:00
model(params) {
2019-11-06 04:59:35 -05:00
const product_id = params["subscription-id"];
2019-11-28 04:11:48 -05:00
return Subscription.show(product_id).then((result) => {
result.product = Product.create(result.product);
result.plans = result.plans.map((plan) => {
return Plan.create(plan);
});
2019-11-04 00:37:21 -05:00
return result;
});
}
}