Answer the question
In order to leave comments, you need to log in
How to properly configure Adapter Ember.js and Model for received data?
Hello.
Faced such a problem there is an adapter
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
host: 'http://local:8070/api', // допустим
headers: {
'access-token': 'блаблаблабла'
}
});
{
"data": {
"profiles": [
{
"id": 169,
"slug": "Ivanov-Ivan",
"photo": "/api/user/169/photo",
"first_name": "ChangedFirst",
"last_name": "ChangedLast",
"email": "[email protected]",
"phone": "0808956745678",
"about": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo i",
"tags": {
"top": [
"PHP",
"JS"
],
"additional": [
"HTML",
"CSS",
"C++",
"JAVA",
"C#"
]
},
"position": null,
"birthday": null,
"experience_year": 0,
"languages": null,
"degree": "No Degree",
"residence": null,
"link_linkedin": null,
"link_video": null,
"portfolio": []
},
import Ember from 'ember';
export default Ember.Route.extend({
model(){
return this.store.findAll('surveys')
}
});
Answer the question
In order to leave comments, you need to log in
Either use JSONAPI and then everything will work out of the box, or read the RESTAdapter description , it says how the api request / response should look like.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question