From efc784048812101a7418df3f7af42d8bf23d47d6 Mon Sep 17 00:00:00 2001 From: Henry Taeschner Date: Sun, 22 Dec 2024 12:08:41 +0100 Subject: [PATCH] fix: simplify code --- .../announcement-detail.component.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/app/announcement/announcement-detail/announcement-detail.component.ts b/src/app/announcement/announcement-detail/announcement-detail.component.ts index db20c73..dd1a453 100644 --- a/src/app/announcement/announcement-detail/announcement-detail.component.ts +++ b/src/app/announcement/announcement-detail/announcement-detail.component.ts @@ -6,8 +6,6 @@ import { SelectItem } from 'primeng/api' import { PortalMessageService, UserService } from '@onecx/portal-integration-angular' import { - CreateAnnouncementRequest, - UpdateAnnouncementRequest, Announcement, AnnouncementPriorityType, AnnouncementStatus, @@ -160,7 +158,7 @@ export class AnnouncementDetailComponent implements OnChanges { this.announcementApi .updateAnnouncementById({ id: this.announcement?.id, - updateAnnouncementRequest: this.submitFormValues() as UpdateAnnouncementRequest + updateAnnouncementRequest: this.formGroup.value }) .subscribe({ next: () => { @@ -176,7 +174,7 @@ export class AnnouncementDetailComponent implements OnChanges { if (['COPY', 'CREATE'].includes(this.changeMode)) { this.announcementApi .createAnnouncement({ - createAnnouncementRequest: this.submitFormValues() as CreateAnnouncementRequest + createAnnouncementRequest: this.formGroup.value }) .subscribe({ next: () => { @@ -191,10 +189,6 @@ export class AnnouncementDetailComponent implements OnChanges { } } - private submitFormValues(): Announcement { - return { ...this.formGroup.value } as Announcement - } - /**************************************************************************** * SERVER responses & internal */