64503: Content Source PUT request on form submit

This commit is contained in:
Kristof De Langhe
2019-08-20 17:28:28 +02:00
parent 764f532b99
commit 1b9bc2f7a3
5 changed files with 87 additions and 11 deletions

View File

@@ -331,9 +331,16 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
* Submit the edited Content Source to the REST API, re-initialize the field update and display a notification
*/
onSubmit() {
// TODO: Fetch field update and send to REST API
this.initializeOriginalContentSource();
this.notificationsService.success(this.getNotificationTitle('saved'), this.getNotificationContent('saved'));
this.collectionRD$.pipe(
getSucceededRemoteData(),
map((col) => col.payload.uuid),
switchMap((uuid) => this.collectionService.updateContentSource(uuid, this.contentSource)),
take(1)
).subscribe((contentSource: ContentSource) => {
this.contentSource = contentSource;
this.initializeOriginalContentSource();
this.notificationsService.success(this.getNotificationTitle('saved'), this.getNotificationContent('saved'));
});
}
/**