117287: Prevent /api/eperson/epersons/undefined from being fired on the create ePerson page

(cherry picked from commit 0cb5b76159)
This commit is contained in:
Alexandre Vryghem
2024-10-29 18:33:01 +01:00
parent 2a72fac646
commit b5a8b56473

View File

@@ -223,9 +223,11 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
* This method will initialise the page
*/
initialisePage() {
this.subs.push(this.epersonService.findById(this.route.snapshot.params.id).subscribe((ePersonRD: RemoteData<EPerson>) => {
this.epersonService.editEPerson(ePersonRD.payload);
}));
if (this.route.snapshot.params.id) {
this.subs.push(this.epersonService.findById(this.route.snapshot.params.id).subscribe((ePersonRD: RemoteData<EPerson>) => {
this.epersonService.editEPerson(ePersonRD.payload);
}));
}
this.firstName = new DynamicInputModel({
id: 'firstName',
label: this.translateService.instant(`${this.messagePrefix}.firstName`),