discourse-subscriptions/assets/javascripts/discourse/models/admin-subscription.js.es6

21 lines
524 B
Plaintext
Raw Normal View History

2019-10-22 19:30:04 -04:00
import computed from "ember-addons/ember-computed-decorators";
2019-10-13 21:36:46 -04:00
import { ajax } from "discourse/lib/ajax";
2019-10-22 19:30:04 -04:00
const AdminSubscription = Discourse.Model.extend({
@computed("created")
createdFormatted(created) {
return moment.unix(created).format();
}
});
2019-10-13 21:36:46 -04:00
AdminSubscription.reopenClass({
find() {
2019-10-15 06:50:30 -04:00
return ajax("/patrons/admin/subscriptions", { method: "get" }).then(
result =>
result.data.map(subscription => AdminSubscription.create(subscription))
2019-10-13 21:36:46 -04:00
);
}
});
export default AdminSubscription;