plans and products
This commit is contained in:
@@ -14,9 +14,15 @@ const AdminPlan = Discourse.Model.extend({
|
||||
const data = {
|
||||
interval: this.interval,
|
||||
amount: this.amount,
|
||||
name: this.name
|
||||
name: this.name,
|
||||
product: {
|
||||
id: this.product.id,
|
||||
// name: this.product.name
|
||||
}
|
||||
};
|
||||
|
||||
console.log(12, data);
|
||||
|
||||
return ajax("/patrons/admin/plans", { method: "post", data });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
const AdminProduct = Discourse.Model.extend({
|
||||
isNew: false,
|
||||
metadata: {},
|
||||
|
||||
destroy() {
|
||||
return ajax(`/patrons/admin/products/${this.id}`, { method: "delete" });
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ajax } from "discourse/lib/ajax";
|
||||
const Plan = Discourse.Model.extend({});
|
||||
|
||||
Plan.reopenClass({
|
||||
find() {
|
||||
findAll() {
|
||||
return ajax("/patrons/plans", { method: "get" }).then(result =>
|
||||
result.plans.map(plan => Plan.create(plan))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user