Ghost/ghost/admin/app/components/dashboard/v5/recent-posts.js

16 lines
446 B
JavaScript
Raw Normal View History

import Component from '@glimmer/component';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
import {tracked} from '@glimmer/tracking';
export default class RecentPosts extends Component {
@service store;
@tracked posts = [];
@action
async loadPosts() {
this.posts = await this.store.query('post', {limit: 5, filter: 'status:published', order: 'published_at desc'});
}
}