Skip to content

Instantly share code, notes, and snippets.

@janpauldahlke
Last active August 19, 2021 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janpauldahlke/d5b8fbbfe532a98afe0d959d74776a5e to your computer and use it in GitHub Desktop.
Save janpauldahlke/d5b8fbbfe532a98afe0d959d74776a5e to your computer and use it in GitHub Desktop.
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