import Button from '@/components/buttons/Button.vue'
import ToggleButton from '@/components/buttons/ToggleButton.vue'
import CSConnector from '@/components/charging-stations/CSConnector.vue'
-import { useUIClient } from '@/composables'
+import { deleteFromLocalStorage, getLocalStorage, useUIClient } from '@/composables'
import { useToast } from 'vue-toast-notification'
const props = defineProps<{
uiClient
.deleteChargingStation(props.chargingStation.stationInfo.hashId)
.then(() => {
+ for (const key in getLocalStorage()) {
+ if (key.includes(props.chargingStation.stationInfo.hashId)) {
+ deleteFromLocalStorage(key)
+ }
+ }
return $toast.success('Charging station successfully deleted')
})
.catch((error: Error) => {
() => {
setToLocalStorage<number>('uiServerConfigurationIndex', state.uiServerIndex)
clearToggleButtons()
+ refresh()
$route.name !== 'charging-stations' &&
$router.push({ name: 'charging-stations' })
},
uiServerIndex: getFromLocalStorage<number>('uiServerConfigurationIndex', 0),
})
+const refresh = (): void => {
+ state.value.renderChargingStations = randomUUID()
+ state.value.renderAddChargingStations = randomUUID()
+}
+
const clearToggleButtons = (): void => {
for (const key in getLocalStorage()) {
if (key.includes('toggle-button')) {
deleteFromLocalStorage(key)
}
}
- state.value.renderChargingStations = randomUUID()
- state.value.renderAddChargingStations = randomUUID()
}
const app = getCurrentInstance()