G
G
GaserV2017-04-09 14:13:12
Ember.js
GaserV, 2017-04-09 14:13:12

Why are items not loading in the store?

Hello! Such a problem. I use restadapter. API written in Laravel. So. I'm getting back an array of objects. The model has been created. There are items in the response in the console, but they are not loaded to the side. Why?
Laravel:

Route::get('jobs', ['middleware' => 'cors', function()
{
    return \Response::json(\App\Job::all(), 200);
}]);

In the console I see this - WARNING: Encountered "0" in payload, but no model was found for model name "0" (resolved model name using [email protected]:application:.modelNameFromPayloadKey("0"))
I think it's in the serializer. Created a serializer but didn't help
import DS from 'ember-data';

export default DS.RESTSerializer.extend({
  normalizeResponse(store, primaryModelClass, payload, id, requestType) {
    const { data } = payload;

    if (data) {
      arguments[2] = data;
    }

    let json = this._super(...arguments);

    return json;
  }
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question