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

Laravel 5 Customize Serialize Data

$
0
0

@rizkiandrianto wrote:

Hello Everyone,

First question on this forum..

I'm pretty new in ember,

I want to load users, but in my JSON response is:


{
"total":3,
"per_page":20,
"current_page":1,
"last_page":1,
"next_page_url":null,
"prev_page_url":null,
"from":1,
"to":3,
"data":[
{
"id":7,
"email":"rizki@talenta.co",
"first_name":"Rizki",
"last_name":"Andrianto",
"created_at":"2016-06-28 08:54:28",
"updated_at":"2016-06-28 08:54:28"
},
{
"id":21,
"email":"yansen@talenta.co",
"first_name":"Yansen",
"last_name":"Tan",
"created_at":"2016-07-21 10:12:21",
"updated_at":"2016-07-21 10:12:21"
},
{
"id":115,
"email":"uray@talenta.co",
"first_name":"Uray",
"last_name":"Chrisna",
"created_at":"2016-07-29 14
:13:35",
"updated_at":"2016-07-29 14:13:35"
}
]
}

and my app/model/users:

//import Model from 'ember-data/model';
import DS from 'ember-data';

export default DS.Model.extend({
	total: DS.attr('number'),
	per_page: DS.attr('number'),
	current_page: DS.attr('number'),
	last_page: DS.attr('number'),
	next_page_url: DS.attr('string'),
	users: DS.attr()
});

but I get :
WARNING: Encountered "data" in payload, but no model was found for model name "datum" (resolved model name using ember-jwt@serializer:-rest:.modelNameFromPayloadKey("data"))

How to display only the user or all of them without changin the backend?
I want to google this, but I don't know the keyword..

Thank you..

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4827

Trending Articles