lundi 25 avril 2016

Error wile loading data using EmberJS

I try to show all data loaded from server using EmberJS. I have model "node"

import DS from 'ember-data';

export default DS.Model.extend({
  id: DS.attr(),
  nodeName: DS.attr(),
  address: DS.attr(),
  listeningPort: DS.attr(),
  approved: DS.attr()

});

Adapter is

import JSONAPIAdapter from 'ember-data/adapters/json-api';

export default JSONAPIAdapter.extend({
  namespace: 'api/v1'
});

Also I have index route

import Ember from 'ember';

export default Ember.Route.extend({
  model(){
    return this.store.findAll('node');
  }
});

When index rote is opened a request is sent to http://localhost:8080/api/v1/nodes which returns JSON

{
    "nodes": [
        {
            "address": "127.0.0.1",
            "approved": true,
            "id": 24,
            "listeningPort": 54879,
            "nodeName": "Узел оборудования"
        }
    ]
}

Error appears while parsing this JSON

vendor-c5c8d3d….js:11 Error while processing route: index Cannot read property 'type' of undefined TypeError: Cannot read property 'type' of undefined

How can I fix this problem?




Aucun commentaire:

Enregistrer un commentaire