I'm creating a new adapter and model and trying to fetch data to use it in my template. When I make a request in route, the data in the model looks like this:
The actual response looks like this:
I really have no idea why ember store returns the data with wrong ID's(the first two objects are objects from the response - but the id fields don't match) and some internal methods.
Code for the adapter:
export default DS.RESTAdapter.extend(UrlTemplates, {
session: Ember.inject.service('session'),
findAll() {
const token = this.get('session.data.authenticated.access_token');
return this.ajax(`${window.App.host}/distributor/${1}/companies?access_token=${token}`);
}
});
Code for the router:
model() {
return Ember.RSVP.hash({
companies: this.store.findAll('distributor/distributors')
});
},
As you can see, this is pretty usual process.If I log data from the request in route, it is already mixed up. Considering Ember Data's data flow I assume that the data is being mixed up in the store. Is there any way to fix this?
Aucun commentaire:
Enregistrer un commentaire