mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
redirect back to the list after an eperson add, edit or delete
This commit is contained in:
@@ -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;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -359,7 +359,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
const response = this.epersonService.updateEPerson(editedEperson);
|
||||
response.pipe(take(1)).subscribe((rd: RemoteData<EPerson>) => {
|
||||
response.pipe(getFirstCompletedRemoteData()).subscribe((rd: RemoteData<EPerson>) => {
|
||||
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<NoContent>) => {
|
||||
this.epersonService.deleteEPerson(eperson).pipe(getFirstCompletedRemoteData()).subscribe((restResponse: RemoteData<NoContent>) => {
|
||||
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user