Ghost/ghost/admin/app/controllers/members.js
Kevin Ansfield 7ec48b36e0 First pass at members list
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
2019-01-24 19:34:32 +00:00

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);
})
});