mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-07-30 17:53:42 +00:00
21 lines
455 B
JavaScript
21 lines
455 B
JavaScript
import EmberObject from "@ember/object";
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
const Product = EmberObject.extend({});
|
|
|
|
Product.reopenClass({
|
|
findAll() {
|
|
return ajax("/s/products", { method: "get" }).then((result) =>
|
|
result.map((product) => Product.create(product))
|
|
);
|
|
},
|
|
|
|
find(id) {
|
|
return ajax(`/s/products/${id}`, { method: "get" }).then((product) =>
|
|
Product.create(product)
|
|
);
|
|
},
|
|
});
|
|
|
|
export default Product;
|