Skip to content

Commit

Permalink
fix: empty endpoint group check
Browse files Browse the repository at this point in the history
  • Loading branch information
mukul-tyagi08 committed Dec 10, 2024
1 parent 7c3e9dd commit 802ebc1
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ export class ApiProxyHealthCheckComponent implements OnInit, OnDestroy {
onlyApiV2Filter(this.snackBarService),
switchMap((api) => {
const apiHealthCheck = ApiProxyHealthCheckFormComponent.HealthCheckFromFormGroup(this.healthCheckForm, false);
this.updateEndpointsHealthCheckConfig(api.proxy?.groups);
try {
this.updateEndpointsHealthCheckConfig(api.proxy?.groups);
} catch (error) {
this.snackBarService.error('Failed to update configuration. Please ensure endpoint groups are properly defined.');
return EMPTY;
}

return this.apiService.update(api.id, {
...api,
Expand All @@ -102,7 +107,7 @@ export class ApiProxyHealthCheckComponent implements OnInit, OnDestroy {

updateEndpointsHealthCheckConfig(groups: Proxy['groups']) {
groups.forEach((group) => {
group.endpoints.forEach((endpoint) => {
group.endpoints?.forEach((endpoint) => {
// If healthcheck is disabled, set inherit to false
if (
(endpoint.healthCheck?.inherit === undefined || endpoint.healthCheck?.inherit === true) &&
Expand Down

0 comments on commit 802ebc1

Please sign in to comment.