@@ -2,7 +2,7 @@ import { Component, inject, OnInit } from '@angular/core';
2
2
import { MatTableModule } from '@angular/material/table' ;
3
3
import { Subject , takeUntil } from 'rxjs' ;
4
4
import { InstallationsService } from '../../../services/api/installations.service' ;
5
- import { Target , Targets , TargetsService } from '../../../services/api/targets.service' ;
5
+ import { Target , Targets , TargetsService , RecalculateTargetsResponse } from '../../../services/api/targets.service' ;
6
6
import { MatIconModule } from '@angular/material/icon' ;
7
7
import { MatButtonModule } from '@angular/material/button' ;
8
8
import { MAT_DIALOG_DATA , MatDialog , MatDialogActions , MatDialogContent , MatDialogRef , MatDialogTitle } from '@angular/material/dialog' ;
@@ -150,8 +150,9 @@ export class CopilotValueModelingComponent implements OnInit {
150
150
151
151
resetTargets ( ) {
152
152
// Call the backend endpoint to recalculate targets
153
- this . targetsService . recalculateTargets ( ) . subscribe ( ( result : any ) => {
154
- const targets = result . targets || result ; // handle both {targets, logs} and just targets
153
+ this . targetsService . recalculateTargets ( ) . subscribe ( ( result : RecalculateTargetsResponse ) => {
154
+ // Handle response format - could be {targets: Targets, logs?: any[]} or just Targets
155
+ const targets = 'targets' in result ? result . targets : result as Targets ;
155
156
this . orgDataSource = this . transformTargets ( targets . org ) ;
156
157
this . userDataSource = this . transformTargets ( targets . user ) ;
157
158
this . impactDataSource = this . transformTargets ( targets . impact ) ;
0 commit comments