lundi 24 octobre 2016

Emberjs: error when loading data from remote API

I am working with EmberJs and I have a problem with JSON adapter, as you can see below:

export default DS.JSONAPIAdapter.extend({
  host: 'url',
  headers: {
    'X-Mashape-Key': 'key'
  }
});

I have adapter with a basic configuration and also a route with

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

and model player

export default DS.Model.extend({
  fullname: DS.attr('string'),
  nationality: DS.attr('string'),
  number: DS.attr('number'),
  position: DS.attr('number'),
  goals: DS.attr('number'),
});

and I received under console such as errors:

ember.debug.js:30287 Error while processing route: index Ember Data Request GET https://... returned a 404

and

ember.debug.js:19157 Error: Ember Data Request GET https://... returned a 404 Payload (application/json)

I am not sure what I am doing wrong. I was trying to check what kind of data I received but without results.




Aucun commentaire:

Enregistrer un commentaire