cms/app-client/mirage/serializers/discourse.js
changeset 532 1190ea937f2d
parent 474 245b4df137d3
equal deleted inserted replaced
531:48f5380c26d0 532:1190ea937f2d
     1 import { JSONAPISerializer } from 'ember-cli-mirage';
     1 import { JSONAPISerializer } from 'ember-cli-mirage';
     2 
     2 
     3 import _ from 'lodash/lodash';
     3 import _ from 'lodash';
     4 
     4 
     5 export default JSONAPISerializer.extend({
     5 export default JSONAPISerializer.extend({
     6     serialize(response, request) {
     6     serialize(response, request) {
     7 
     7 
     8       let json = JSONAPISerializer.prototype.serialize.apply(this, arguments);
     8       let json = JSONAPISerializer.prototype.serialize.apply(this, arguments);
    19       return { 'discourses' : _(json.data).map((discourse) => {
    19       return { 'discourses' : _(json.data).map((discourse) => {
    20         return [
    20         return [
    21           discourse.id,
    21           discourse.id,
    22           { count: discourse.attributes.count, label: discourse.attributes.label}
    22           { count: discourse.attributes.count, label: discourse.attributes.label}
    23         ];
    23         ];
    24       }).object().value()};
    24       }).fromPairs().value()};
    25     }
    25     }
    26 });
    26 });