From: Jérôme Benoit Date: Fri, 22 Mar 2024 08:58:26 +0000 (+0100) Subject: fix: ensure add charging stations reponse display only the necessary X-Git-Tag: v1.3.1~16 X-Git-Url: https://git.piment-noir.org/?p=e-mobility-charging-stations-simulator.git;a=commitdiff_plain;h=2ea8735dffc06e2aa7442971134d2c0cd3100872 fix: ensure add charging stations reponse display only the necessary fields Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ui-server/ui-services/AbstractUIService.ts b/src/charging-station/ui-server/ui-services/AbstractUIService.ts index 3fa3f8ba..6ba08807 100644 --- a/src/charging-station/ui-server/ui-services/AbstractUIService.ts +++ b/src/charging-station/ui-server/ui-services/AbstractUIService.ts @@ -302,7 +302,9 @@ export abstract class AbstractUIService { } return { status: failedStationInfos.length > 0 ? ResponseStatus.FAILURE : ResponseStatus.SUCCESS, - hashIdsSucceeded: succeededStationInfos.map(stationInfo => stationInfo.hashId), + ...(succeededStationInfos.length > 0 && { + hashIdsSucceeded: succeededStationInfos.map(stationInfo => stationInfo.hashId) + }), ...(failedStationInfos.length > 0 && { hashIdsFailed: failedStationInfos.map(stationInfo => stationInfo.hashId) }),