Skip to content

Commit

Permalink
Update DelegateType in line
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian committed Aug 30, 2024
1 parent 44e1dc5 commit a69ff7f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/app/delegate-types/delegate-types.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,20 @@ export class DelegateTypesComponent extends WsComponent implements OnInit {
}

save(dt: DelegateType): void {
(dt.id === 0 ? this.delTypeService.create(this.selectedEvent.id, dt) : this.delTypeService.update(this.selectedEvent.id, dt)).subscribe(res => {
this.loadData();
this.manageDelType = null;
this.toastService.success('Delegate Type is saved!');
});
if (dt.id === 0) {
this.delTypeService.create(this.selectedEvent.id, dt).subscribe(res => {
this.loadData();
this.manageDelType = null;
this.toastService.success('Delegate Type is saved!');
});
} else {
this.delTypeService.update(this.selectedEvent.id, dt).subscribe(res => {
const index = this.delegateTypes.findIndex(d => d.id === dt.id);
this.delegateTypes[index] = dt;
this.manageDelType = null;
this.toastService.success('Delegate Type is saved!');
});
}
}

deleteDelType(dt: DelegateType): void {
Expand Down

0 comments on commit a69ff7f

Please sign in to comment.