cms/app-client/app/serializers/theme.js
author Chloe Laisne <chloe.laisne@gmail.com>
Sun, 02 Oct 2016 15:24:56 +0200
changeset 311 f4327199e8f0
parent 179 9b703ece424f
child 319 78990a8a069b
permissions -rw-r--r--
Solve count value on discourses

import DS from 'ember-data';

export default DS.JSONSerializer.extend({

    normalizeResponse: function(store, primaryModelClass, payload) {
        var data = [];
        Object.keys(payload).forEach(function(key) {
            data.push({
                'id': key,
                'type': 'theme',
                'attributes': {
                    'label': payload[key].label,
                    'count': payload[key].count
                }
            });
        });
        return {
            'data': data
        };
    }

});