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

20 lines
664 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 Product from "discourse/plugins/discourse-subscriptions/discourse/models/product";
import Plan from "discourse/plugins/discourse-subscriptions/discourse/models/plan";
import Subscription from "discourse/plugins/discourse-subscriptions/discourse/models/subscription";
2019-11-04 00:37:21 -05:00
2019-12-12 19:54:32 -05:00
export default Route.extend({
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;
});
2020-09-16 10:53:50 -04:00
},
2019-11-04 00:37:21 -05:00
});