cms/app-client/mirage/serializers/language.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);
    14           resLang.attributes.count = Math.max(Math.floor(resLang.attributes.count / 2), 1);
    14           resLang.attributes.count = Math.max(Math.floor(resLang.attributes.count / 2), 1);
    15           return resLang;
    15           return resLang;
    16         })};
    16         })};
    17       }
    17       }
    18 
    18 
    19       return {'languages' : _(json.data).map((lang) => { return [lang.id, lang.attributes.count];}).object().value()};
    19       return {'languages' : _(json.data).map((lang) => { return [lang.id, lang.attributes.count];}).fromPairs().value()};
    20     }
    20     }
    21 });
    21 });