UI protocol: Include failed responses
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 4 Sep 2022 20:54:44 +0000 (22:54 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 4 Sep 2022 20:54:44 +0000 (22:54 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/UIServiceWorkerBroadcastChannel.ts
src/types/UIProtocol.ts

index c556b26c8ccacf1f5b21b80c9e7afe2accbc235d..7e4cc87720f81e10dacb625c00ed1474a821260d 100644 (file)
@@ -81,6 +81,16 @@ export default class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChan
           })
           .filter((hashId) => hashId !== undefined),
       }),
+      ...(responsesStatus === ResponseStatus.FAILURE && {
+        responsesFailed: this.responses
+          .get(uuid)
+          ?.responses.map((response) => {
+            if (response.status === ResponseStatus.FAILURE) {
+              return response;
+            }
+          })
+          .filter((response) => response !== undefined),
+      }),
     };
   }
 
index ab46f0355e717ffd018017357c871be44a2fed2d..0e4fb77a2c9658a904c357b7cf65cb65fa3e724e 100644 (file)
@@ -1,4 +1,5 @@
 import type { JsonObject } from './JsonType';
+import type { BroadcastChannelResponsePayload } from './WorkerBroadcastChannel';
 
 export enum Protocol {
   UI = 'ui',
@@ -53,4 +54,5 @@ export interface ResponsePayload extends JsonObject {
   status: ResponseStatus;
   hashIdsSucceeded?: string[];
   hashIdsFailed?: string[];
+  responsesFailed?: BroadcastChannelResponsePayload[];
 }