Last active
August 19, 2021 16:35
-
-
Save janpauldahlke/d5b8fbbfe532a98afe0d959d74776a5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
save(close?: boolean): void { | |
this.resourceService | |
.save(this.formName, this.id, this.workItemForm.value) | |
.pipe( | |
tap(res => { | |
if (close) { | |
// Sofort Schließen, Rest interessiert uns nicht | |
this.savedAndClosing.emit({ wi_resourceType: 'researchStudy', wi_id: this.id } as IWorkItem); | |
return; | |
} | |
if (this.id !== res.id) { | |
// Wechsel von temporärer auf permanente ID | |
this.idChanged.emit({ old: this.id, new: res.id }); | |
} | |
const formValue = createResourceFormValue(res); | |
this.workItemForm.reset(formValue); | |
}) | |
).subscribe(); | |
// sideeffect to handle https://foo | |
if (this.deviceComposition && this.deviceComposition.id.length > 1) { | |
const { id, value } = this.deviceComposition; | |
const fromDTO: R4.IComposition = { | |
id, | |
...createDeviceCompositionResource(value), | |
}; | |
this.compositionService.save( | |
'Composition', | |
fromDTO, | |
).pipe( | |
tap((res) => { | |
console.log('res', res); | |
return res; | |
}) | |
).subscribe(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment