fix: ensure add charging stations reponse display only the necessary
[e-mobility-charging-stations-simulator.git] / 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)
       }),