fix: ensure add charging stations reponse display only the necessary
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 22 Mar 2024 08:58:26 +0000 (09:58 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 22 Mar 2024 08:58:26 +0000 (09:58 +0100)
fields

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ui-server/ui-services/AbstractUIService.ts

index 3fa3f8ba756782567755b9a24c4dcf883de99489..6ba08807b3afcecc895428cab5911797f9cbf718 100644 (file)
@@ -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)
       }),