I have an action in one of my Ember controllers where I am making a call to my backend, and ESLint is giving me an error
Ember Expected property shorthand object-shorthand
I'm new to Ember, and somewhat new to ES6 syntax, so I'm not entirely sure how this chunk of code could be made any more 'shorthand'.
Controller
merge(preserve) {
let experienceIdList = [];
// To-Do Make this a computed property
get(this, 'model.experiences').forEach(function(experience) {
experienceIdList.pushObject(experience.id);
});
$.ajax({
url: `${config.EmberENV.API_HOST}/api/v0.1/experiences/merge/`,
type: 'POST',
data: {
'experience_ids': experienceIdList,
'name': get(this, 'model.newExperience.name'),
'preserve': preserve,
'moduleExperience': get(this, 'moduleExperience')
}
}).then(() => {
this.transitionToRoute('authenticated.experiences');
}).catch(function(error) {
this.set('errorMessage', error.error || error);
});
}
Aucun commentaire:
Enregistrer un commentaire