mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
7ec48b36e0
no issue - don't nest details route as it's not nested UI - implement styled list of members - add `<MemberAvatar>` component that generates random background colour and initials based on member name - fixed generation of fake member details in mirage
32 lines
748 B
JavaScript
32 lines
748 B
JavaScript
import Controller from '@ember/controller';
|
|
import {computed} from '@ember/object';
|
|
import {task} from 'ember-concurrency';
|
|
|
|
/* eslint-disable ghost/ember/alias-model-in-controller */
|
|
export default Controller.extend({
|
|
queryParams: ['page'],
|
|
|
|
meta: null,
|
|
members: null,
|
|
|
|
page: computed('meta.pagination.page', function () {
|
|
let page = this.get('meta.pagination.page');
|
|
|
|
if (!page || page === 1) {
|
|
return null;
|
|
}
|
|
|
|
return page;
|
|
}),
|
|
|
|
fetchMembers: task(function* () {
|
|
let results = yield this.store.query('member', {
|
|
page: this.page || 1,
|
|
limit: 15
|
|
});
|
|
|
|
this.set('meta', results.meta);
|
|
this.set('members', results);
|
|
})
|
|
});
|