refactor: cleanup boot notification response handling
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 6 Jun 2024 18:33:22 +0000 (20:33 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 6 Jun 2024 18:33:22 +0000 (20:33 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/charging-station/ChargingStation.ts

index e8d6387fc5d3f6513f7809dbe9470a5dcbcce53a..2022305232d0ca19e3406166b1bddf42514d4eb8 100644 (file)
@@ -1843,13 +1843,10 @@ export class ChargingStation extends EventEmitter {
           >(this, RequestCommand.BOOT_NOTIFICATION, this.bootNotificationRequest, {
             skipBufferingOnError: true
           })
-          // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
-          if (this.bootNotificationResponse?.currentTime != null) {
-            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-            this.bootNotificationResponse.currentTime = convertToDate(
-              this.bootNotificationResponse.currentTime
-            )!
-          }
+          // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+          this.bootNotificationResponse!.currentTime = convertToDate(
+            this.bootNotificationResponse?.currentTime
+          )!
           if (!this.isRegistered()) {
             this.stationInfo?.registrationMaxRetries !== -1 && ++registrationRetryCount
             await sleep(