cms/app-client/app/serializers/theme.js
author Chloe Laisne <chloe.laisne@gmail.com>
Tue, 07 Jun 2016 12:18:53 +0200
changeset 178 4d051f080e7e
parent 176 d1baf7ccecc8
child 179 9b703ece424f
permissions -rw-r--r--
JSLint /discourses

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
        };
    }

});