- loadChargingStations(() => (state.renderChargingStationsList = randomUUID()))
- })
- app?.appContext.config.globalProperties.$uiClient.registerWSEventListener('error', () => {
- app.appContext.config.globalProperties.$chargingStations = []
- state.renderChargingStationsList = randomUUID()
- })
- app?.appContext.config.globalProperties.$uiClient.registerWSEventListener('close', () => {
- app.appContext.config.globalProperties.$chargingStations = []
- state.renderChargingStationsList = randomUUID()
+ uiClient
+ .listTemplates()
+ .then((response: ResponsePayload) => {
+ if (app != null) {
+ app.appContext.config.globalProperties.$templates = response.templates
+ }
+ })
+ .catch((error: Error) => {
+ if (app != null) {
+ app.appContext.config.globalProperties.$templates = []
+ }
+ $toast.error('Error at fetching charging station templates')
+ console.error('Error at fetching charging station templates:', error)
+ })
+ loadChargingStations(() => {
+ state.value.renderAddChargingStations = randomUUID()
+ state.value.renderChargingStations = randomUUID()
+ })