X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FConfigurationKeyUtils.ts;h=d1d093f7e978d832453b1bc1e585460d2e09f227;hb=6a4032b5d8f3cbaa18d3beddcdfe9d335c1cba90;hp=96a13e71d44f3f2da4c92b50e151d6a96d50c189;hpb=7f3decca34321ef6f6bf3b7f40a50db75dae1eed;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ConfigurationKeyUtils.ts b/src/charging-station/ConfigurationKeyUtils.ts index 96a13e71..d1d093f7 100644 --- a/src/charging-station/ConfigurationKeyUtils.ts +++ b/src/charging-station/ConfigurationKeyUtils.ts @@ -46,13 +46,13 @@ export const addConfigurationKey = ( }; params = { ...{ overwrite: false, save: false }, ...params }; let keyFound = getConfigurationKey(chargingStation, key); - if (keyFound && params?.overwrite) { + if (keyFound !== undefined && params?.overwrite === true) { deleteConfigurationKey(chargingStation, keyFound.key, { save: false, }); keyFound = undefined; } - if (!keyFound) { + if (keyFound === undefined) { chargingStation.ocppConfiguration?.configurationKey?.push({ key, readonly: options.readonly!, @@ -76,7 +76,7 @@ export const setConfigurationKeyValue = ( caseInsensitive = false, ): void => { const keyFound = getConfigurationKey(chargingStation, key, caseInsensitive); - if (keyFound) { + if (keyFound !== undefined) { chargingStation.ocppConfiguration!.configurationKey![ chargingStation.ocppConfiguration!.configurationKey!.indexOf(keyFound) ].value = value; @@ -96,7 +96,7 @@ export const deleteConfigurationKey = ( ): ConfigurationKey[] | undefined => { params = { ...{ save: true, caseInsensitive: false }, ...params }; const keyFound = getConfigurationKey(chargingStation, key, params?.caseInsensitive); - if (keyFound) { + if (keyFound !== undefined) { const deletedConfigurationKey = chargingStation.ocppConfiguration?.configurationKey?.splice( chargingStation.ocppConfiguration.configurationKey.indexOf(keyFound), 1,