diff --git a/alfa-client/libs/postfach/src/lib/postfach-mail-form/postfach-mail.formservice.ts b/alfa-client/libs/postfach/src/lib/postfach-mail-form/postfach-mail.formservice.ts index 0b5beafc1adce4838b207bd61e9a411ab747b462..858d745b0063d9fec1e8bac7dd668d0a3d297171 100644 --- a/alfa-client/libs/postfach/src/lib/postfach-mail-form/postfach-mail.formservice.ts +++ b/alfa-client/libs/postfach/src/lib/postfach-mail-form/postfach-mail.formservice.ts @@ -32,7 +32,7 @@ import { UntypedFormGroup, } from '@angular/forms'; import { ReplyOption } from 'libs/postfach-shared/src/lib/postfach.model'; -import { Observable, Subscription } from 'rxjs'; +import { Observable, take } from 'rxjs'; @Injectable() export class PostfachMailFormservice extends AbstractFormService { @@ -43,8 +43,6 @@ export class PostfachMailFormservice extends AbstractFormService { static readonly FIELD_REPLY_OPTION = 'replyOption'; static readonly FIELD_ATTACHMENTS = 'attachments'; - private loadPostfachSettingsSubscription: Subscription; - constructor( formBuilder: UntypedFormBuilder, private postfachService: PostfachService, @@ -63,13 +61,13 @@ export class PostfachMailFormservice extends AbstractFormService { } public initMailBody(): void { - this.loadPostfachSettingsSubscription = this.postfachService + this.postfachService .getSettings() + .pipe(take(1)) .subscribe((settings: PostfachSettings) => { if (settings.signatur) { this.patchMailBodyWithSignaturAndNewline(settings.signatur); } - this.loadPostfachSettingsSubscription.unsubscribe(); }); }