refactor: cleanup UI service response
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 30 Jan 2024 20:25:46 +0000 (21:25 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 30 Jan 2024 20:25:46 +0000 (21:25 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts

index 89f828b5a266bb7e57bf2ce0e669e108976f87b4..10d0c75c3aff0ad88776f0d76a2fb80cca665c5e 100644 (file)
@@ -285,7 +285,6 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
       return
     }
     let responsePayload: BroadcastChannelResponsePayload | undefined
-    let commandResponse: CommandResponse | undefined
     this.commandHandler(command, requestPayload)
       .then(commandResponse => {
         if (commandResponse == null || isEmptyObject(commandResponse)) {
@@ -311,12 +310,10 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
           status: ResponseStatus.FAILURE,
           command,
           requestPayload,
-          // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-          commandResponse: commandResponse!,
           errorMessage: (error as OCPPError).message,
           errorStack: (error as OCPPError).stack,
           errorDetails: (error as OCPPError).details
-        }
+        } satisfies BroadcastChannelResponsePayload
       })
       .finally(() => {
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion