I am making an API call to get the conference rooms that match the profided filters. The response is returning an array, however Ember is giving me the error:
Error while processing route: rooms Assertion Failed: The response to store.query is expected to be an array but it was a single record. Please wrap your response in an array or use store.queryRecord
to query for a single record.
I am using RESTAdapter.
What am I doing wrong?
route:
import Ember from 'ember';
export default Ember.Route.extend({
model(){
return this.store.query('room', { filter: { option1: 'x', option2: 'y' } }).then(function(rooms) {
return rooms;
});
}
});
Returned by server:
{"rooms":[
{"id":"1","size":"600","title":"Centennial Room","description":""},
{"id":"3","size":"1500","title":"Grand Auditorium","description":""}
]
}
Thank you.
Aucun commentaire:
Enregistrer un commentaire