@@ -2,7 +2,7 @@ import { Component, inject, OnInit } from '@angular/core';
22import { MatTableModule } from '@angular/material/table' ;
33import { Subject , takeUntil } from 'rxjs' ;
44import { 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' ;
66import { MatIconModule } from '@angular/material/icon' ;
77import { MatButtonModule } from '@angular/material/button' ;
88import { MAT_DIALOG_DATA , MatDialog , MatDialogActions , MatDialogContent , MatDialogRef , MatDialogTitle } from '@angular/material/dialog' ;
@@ -150,8 +150,9 @@ export class CopilotValueModelingComponent implements OnInit {
150150
151151 resetTargets ( ) {
152152 // 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 ;
155156 this . orgDataSource = this . transformTargets ( targets . org ) ;
156157 this . userDataSource = this . transformTargets ( targets . user ) ;
157158 this . impactDataSource = this . transformTargets ( targets . impact ) ;
0 commit comments