From: Jérôme Benoit Date: Fri, 1 Mar 2024 22:16:54 +0000 (+0100) Subject: refactor(ui): cleanup helper namespace X-Git-Tag: v1.2.38~8 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b767fda721ad867b55ed76067721483767805930;p=e-mobility-charging-stations-simulator.git refactor(ui): cleanup helper namespace Signed-off-by: Jérôme Benoit --- diff --git a/ui/web/src/composables/Utils.ts b/ui/web/src/composables/Utils.ts index 8cd068b3..46776053 100644 --- a/ui/web/src/composables/Utils.ts +++ b/ui/web/src/composables/Utils.ts @@ -42,7 +42,7 @@ export const getFromLocalStorage = (key: string, defaultValue: T): T => { return item != null ? (JSON.parse(item) as T) : defaultValue } -export const removeFromLocalStorage = (key: string): void => { +export const deleteFromLocalStorage = (key: string): void => { localStorage.removeItem(key) } diff --git a/ui/web/src/composables/index.ts b/ui/web/src/composables/index.ts index 278b82b4..55c28448 100644 --- a/ui/web/src/composables/index.ts +++ b/ui/web/src/composables/index.ts @@ -2,9 +2,9 @@ export { UIClient } from './UIClient' export { convertToBoolean, convertToInt, + deleteFromLocalStorage, getFromLocalStorage, getLocalStorage, randomUUID, - removeFromLocalStorage, setToLocalStorage } from './Utils' diff --git a/ui/web/src/views/ChargingStationsView.vue b/ui/web/src/views/ChargingStationsView.vue index 8e7611e7..1babefba 100644 --- a/ui/web/src/views/ChargingStationsView.vue +++ b/ui/web/src/views/ChargingStationsView.vue @@ -119,10 +119,10 @@ import type { ResponsePayload, UIServerConfigurationSection } from '@/types' import Container from '@/components/Container.vue' import ReloadButton from '@/components/buttons/ReloadButton.vue' import { + deleteFromLocalStorage, getFromLocalStorage, getLocalStorage, randomUUID, - removeFromLocalStorage, setToLocalStorage } from '@/composables' import ToggleButton from '@/components/buttons/ToggleButton.vue' @@ -147,7 +147,7 @@ const app = getCurrentInstance() const clearToggleButtons = (): void => { for (const key in getLocalStorage()) { if (key.includes('toggle-button')) { - removeFromLocalStorage(key) + deleteFromLocalStorage(key) } } }