FEATURE: optimize invite js code

This commit is contained in:
Arpit Jalan 2017-07-01 19:11:39 +05:30
parent 566cf31c66
commit 4fb9269642
1 changed files with 5 additions and 7 deletions

View File

@ -88,12 +88,11 @@ export default Ember.Controller.extend({
},
rescindAll() {
const self = this;
bootbox.confirm(I18n.t("user.invited.rescind_all_confirm"), confirm => {
if (confirm) {
Invite.rescindAll().then(function() {
self.set('rescindedAll', true);
self.get('model.invites').clear();
Invite.rescindAll().then(() => {
this.set('rescindedAll', true);
this.get('model.invites').clear();
}).catch(popupAjaxError);
}
});
@ -105,11 +104,10 @@ export default Ember.Controller.extend({
},
reinviteAll() {
const self = this;
bootbox.confirm(I18n.t("user.invited.reinvite_all_confirm"), confirm => {
if (confirm) {
Invite.reinviteAll().then(function() {
self.set('reinvitedAll', true);
Invite.reinviteAll().then(() => {
this.set('reinvitedAll', true);
}).catch(popupAjaxError);
}
});