diff --git a/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.ts b/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.ts index b548dcc066..11b146b294 100644 --- a/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.ts +++ b/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.ts @@ -283,7 +283,10 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy { this.epersonService.getBrowseEndpoint().pipe( take(1) ).subscribe((href: string) => { - this.requestService.setStaleByHrefSubstring(href); + this.requestService.setStaleByHrefSubstring(href).pipe(take(1)).subscribe(() => { + this.epersonService.cancelEditEPerson(); + this.isEPersonFormShown = false; + }); }); } } diff --git a/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.ts b/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.ts index 59c019f6f6..3c284735a9 100644 --- a/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.ts +++ b/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.ts @@ -359,7 +359,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy { }); const response = this.epersonService.updateEPerson(editedEperson); - response.pipe(take(1)).subscribe((rd: RemoteData) => { + response.pipe(getFirstCompletedRemoteData()).subscribe((rd: RemoteData) => { if (rd.hasSucceeded) { this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.edited.success', { name: editedEperson.name })); this.submitForm.emit(editedEperson); @@ -439,10 +439,10 @@ export class EPersonFormComponent implements OnInit, OnDestroy { modalRef.componentInstance.response.pipe(take(1)).subscribe((confirm: boolean) => { if (confirm) { if (hasValue(eperson.id)) { - this.epersonService.deleteEPerson(eperson).pipe(take(1)).subscribe((restResponse: RemoteData) => { + this.epersonService.deleteEPerson(eperson).pipe(getFirstCompletedRemoteData()).subscribe((restResponse: RemoteData) => { if (restResponse.hasSucceeded) { this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.deleted.success', { name: eperson.name })); - this.reset(); + this.submitForm.emit(); } else { this.notificationsService.error('Error occured when trying to delete EPerson with id: ' + eperson.id + ' with code: ' + restResponse.statusCode + ' and message: ' + restResponse.errorMessage); }