cms/app-client/app/serializers/theme.js
author Chloe Laisne <chloe.laisne@gmail.com>
Mon, 30 May 2016 23:58:34 +0200
changeset 176 d1baf7ccecc8
child 179 9b703ece424f
permissions -rw-r--r--
Add `thematiques` components

import DS from 'ember-data';

export default DS.JSONSerializer.extend({

    normalizeResponse: function(store, primaryModelClass, payload, id, requestType) {
        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
        };
    }

});