Skip to content

Instantly share code, notes, and snippets.

@frcake
Created October 16, 2018 13:15
Show Gist options
  • Save frcake/0c89ef4bb57fdbe4f0861c2942047f8b to your computer and use it in GitHub Desktop.
Save frcake/0c89ef4bb57fdbe4f0861c2942047f8b to your computer and use it in GitHub Desktop.
import Controller from '@ember/controller';
export default Controller.extend({
selectedCountries:null,
actions:{
updateUser(selectedParentRegion,user){
user.get('authorizedRegions').pushObject(this.store.createRecord('authorized-region',{
userId:user.id,
regionId:selectedParentRegion.id,
authorizedCountries:this.get('selectedCountries')
}));
user.save();
},
updateCountrySelection(newSelection) {
this.set('selectedCountries', newSelection);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment