cms/app-client/app/serializers/discourse.js
author ymh <ymh.work@gmail.com>
Wed, 22 Feb 2017 07:57:05 +0100
changeset 519 ef3e4841d506
parent 465 9df336529b2f
permissions -rw-r--r--
Correct bug #0026428 - in notice filter on creation date for period

import DS from 'ember-data';

export default DS.JSONSerializer.extend({

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

});