Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4870

Problem with adapter and serializer

$
0
0

please help me i am in trouble with the following error in my ember application

Error while processing route: index Assertion Failed: You must include an ‘id’ for tasks in an object passed to ‘push’ Error: Assertion Failed: You must include an ‘id’ for tasks in an object passed to ‘push’

Uncaught (in promise) Error: Assertion Failed: You must include an ‘id’ for tasks in an object passed to ‘push’

iam unable to fine that where exact problem is occur.

Model File -

 import Model, { attr } from '@ember-data/model';
 export default class TasksModel extends Model {
   @attr('string') title;
   @attr('string') priyority;
   @attr('date') createdAt;
 }

Adapter file -

import RESTAdapter from '@ember-data/adapter/rest';
 
export default class TasksAdapter extends RESTAdapter {
host = 'http://localhost:3000';
 }

Serializer file-

import RESTSerializer from '@ember-data/serializer/rest';

export default class TasksSerializer extends RESTSerializer {
  normalizeResponse(store, primaryModelClass, payload, id, requestType) {
    return this.normalize(primaryModelClass, payload);
  }
}

5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4870

Trending Articles