cms/app-client/app/serializers/theme.js
author Chloe Laisne <chloe.laisne@gmail.com>
Thu, 20 Oct 2016 12:54:07 +0530
changeset 373 e952c8a31a2b
parent 319 78990a8a069b
child 474 245b4df137d3
permissions -rw-r--r--
Transcript design + Fix video display and filter component font

import DS from 'ember-data';

export default DS.JSONSerializer.extend({

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

});