From 6682f2cb63fddb981542265db411f8ccc958f007 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Tue, 10 Sep 2024 15:52:01 +0200 Subject: [PATCH] OZG-6497 CR Anmerkungen --- .../postfach-form/postfach.formservice.spec.ts | 3 ++- .../settings/src/lib/postfach/postfach.service.ts | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) 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 c188eb39cd..bbc93c26a6 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 8003b1637a..2fc6ec706f 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, -- GitLab