I'm getting an error where ember-data fails to load the data to the local storage in the web browser. I know it queries the server correctly as it gives me a 200 response and while I was debugging it - $E actually stores the staff (my model) properly but then after a couple of emberJS processes, it fails in converting it to ember-data and storing to local database (web browser).
I've made sure that my adapters, serializers, models and routers make sense. Here is what I have on my adapters, serializers, models, etc.
adapter - application.js:
export default DS.RESTAdapter.extend({
addTrailingSlashes: false,
namespace: 'api',
});
serializer - staff.js:
import DRFSerializer from 'ember-django-adapter/serializers/drf';
export default DRFSerializer.extend({
});
routes - staffs.js:
import Ember from 'ember';
export default Ember.Route.extend({
model: function(){
return this.store.find('staff');
}
});
And lastly my model - staff.js
import DS from 'ember-data';
export default DS.Model.extend({
//inherited properties gotten from Members.model
userName: DS.attr('string'),
userFirstName: DS.attr(),
userLastName: DS.attr() //not sure if this needs to be included
....
});
And if any of you are curious, this is what the server returns to my ember:
{
"staffs": [
{
"id": 1,
"userName": "macmania",
"userFirstName": "macmania",
"userLastName": "macmania",
"emailAddress": "macmania"
},
{
"id": 2,
"userName": "macmania123",
"userFirstName": "macmania123 ",
"userLastName": "macmania123",
"emailAddress": "[email protected]"
},
{
"id": 3,
"userName": "macmania123123123",
"userFirstName": "macmania123123",
"userLastName": "Smith",
"emailAddress": "[email protected]"
},
{
"id": 4,
"userName": "macmania123",
"userFirstName": "Jolie",
"userLastName": "Claire",
"emailAddress": "[email protected]"
}
]
}