diff --git a/alfa-client/libs/admin/settings/src/lib/postfach/postfach-container/postfach-form/postfach.formservice.spec.ts b/alfa-client/libs/admin/settings/src/lib/postfach/postfach-container/postfach-form/postfach.formservice.spec.ts index c188eb39cda6ad7cad6653ee45b4724b52c6201d..bbc93c26a6744ea5ae695e9c4400bdeccfdb1f72 100644 --- a/alfa-client/libs/admin/settings/src/lib/postfach/postfach-container/postfach-form/postfach.formservice.spec.ts +++ b/alfa-client/libs/admin/settings/src/lib/postfach/postfach-container/postfach-form/postfach.formservice.spec.ts @@ -9,10 +9,11 @@ import { PostfachFormService } from './postfach.formservice'; describe('PostfachFormService', () => { let formService: PostfachFormService; - const postfachService: Mock<PostfachService> = mock(PostfachService); + let postfachService: Mock<PostfachService>; const formBuilder: FormBuilder = new FormBuilder(); beforeEach(() => { + postfachService = mock(PostfachService); formService = new PostfachFormService(formBuilder, useFromMock(postfachService)); }); diff --git a/alfa-client/libs/admin/settings/src/lib/postfach/postfach.service.ts b/alfa-client/libs/admin/settings/src/lib/postfach/postfach.service.ts index 8003b1637a1e77b577c2cdf254a89dab16ce45a0..2fc6ec706f41b554a0a9812034f45cb596edf9f8 100644 --- a/alfa-client/libs/admin/settings/src/lib/postfach/postfach.service.ts +++ b/alfa-client/libs/admin/settings/src/lib/postfach/postfach.service.ts @@ -19,15 +19,19 @@ export class PostfachService { public save(postfach: Postfach): Observable<StateResource<PostfachResource>> { return this.postfachResourceService.save(this.buildPostfachSettingItem(postfach)).pipe( - tap((stateResource: StateResource<PostfachResource>) => { - if (!stateResource.loading) { - this.snackbarService.showInfo('Die Signatur wird erfolgreich gespeichert.'); - } - }), + tap((stateResource: StateResource<PostfachResource>) => + this.showInfoAfterSave(stateResource), + ), startWith(createEmptyStateResource<PostfachResource>(true)), ); } + private showInfoAfterSave(stateResource: StateResource<PostfachResource>) { + if (!stateResource.loading) { + this.snackbarService.showInfo('Die Signatur wird erfolgreich gespeichert.'); + } + } + private buildPostfachSettingItem(postfach: Postfach): PostfachSettingsItem { return { name: SettingName.POSTFACH,