1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-19 02:51:14 +02:00

Correctly handle errors on remove and reinvite of organization users (#979)

This commit is contained in:
Oscar Hinton 2021-05-17 15:13:26 +02:00 committed by GitHub
parent a27be135da
commit 968a255269
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -234,20 +234,29 @@ export class PeopleComponent implements OnInit {
return false; return false;
} }
this.actionPromise = this.apiService.deleteOrganizationUser(this.organizationId, user.id);
try { try {
await this.apiService.deleteOrganizationUser(this.organizationId, user.id); await this.actionPromise;
this.toasterService.popAsync('success', null, this.i18nService.t('removedUserId', user.name || user.email)); this.toasterService.popAsync('success', null, this.i18nService.t('removedUserId', user.name || user.email));
this.removeUser(user); this.removeUser(user);
} catch { } } catch (e) {
this.validationService.showError(e);
}
this.actionPromise = null;
} }
async reinvite(user: OrganizationUserUserDetailsResponse) { async reinvite(user: OrganizationUserUserDetailsResponse) {
if (this.actionPromise != null) { if (this.actionPromise != null) {
return; return;
} }
this.actionPromise = this.apiService.postOrganizationUserReinvite(this.organizationId, user.id); this.actionPromise = this.apiService.postOrganizationUserReinvite(this.organizationId, user.id);
try {
await this.actionPromise; await this.actionPromise;
this.toasterService.popAsync('success', null, this.i18nService.t('hasBeenReinvited', user.name || user.email)); this.toasterService.popAsync('success', null, this.i18nService.t('hasBeenReinvited', user.name || user.email));
} catch (e) {
this.validationService.showError(e);
}
this.actionPromise = null; this.actionPromise = null;
} }