Skip to content

Commit

Permalink
fix: simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryT-CG committed Dec 22, 2024
1 parent bbb2c08 commit efc7840
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { SelectItem } from 'primeng/api'

import { PortalMessageService, UserService } from '@onecx/portal-integration-angular'
import {
CreateAnnouncementRequest,
UpdateAnnouncementRequest,
Announcement,
AnnouncementPriorityType,
AnnouncementStatus,
Expand Down Expand Up @@ -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: () => {
Expand All @@ -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: () => {
Expand All @@ -191,10 +189,6 @@ export class AnnouncementDetailComponent implements OnChanges {
}
}

private submitFormValues(): Announcement {
return { ...this.formGroup.value } as Announcement
}

/****************************************************************************
* SERVER responses & internal
*/
Expand Down

0 comments on commit efc7840

Please sign in to comment.