+const initializeApp = (app: AppType, config: ConfigurationData) => {
+ app.config.errorHandler = (error, instance, info) => {
+ console.error('Error:', error)
+ console.info('Vue instance:', instance)
+ console.info('Error info:', info)
+ // TODO: add code for UI notifications or other error handling logic
+ }
+ if (!Array.isArray(config.uiServer)) {
+ config.uiServer = [config.uiServer]
+ }
+ if (app.config.globalProperties.$configuration == null) {
+ app.config.globalProperties.$configuration = config
+ }
+ if (!Array.isArray(app.config.globalProperties.$templates)) {
+ app.config.globalProperties.$templates = []
+ }
+ if (!Array.isArray(app.config.globalProperties.$chargingStations)) {
+ app.config.globalProperties.$chargingStations = []
+ }
+ if (
+ getFromLocalStorage<number | undefined>('uiServerConfigurationIndex', undefined) == null ||
+ getFromLocalStorage<number>('uiServerConfigurationIndex', 0) >
+ app.config.globalProperties.$configuration.uiServer.length - 1
+ ) {
+ setToLocalStorage<number>('uiServerConfigurationIndex', 0)
+ }
+ if (app.config.globalProperties.$uiClient == null) {
+ app.config.globalProperties.$uiClient = UIClient.getInstance(
+ app.config.globalProperties.$configuration.uiServer[
+ getFromLocalStorage<number>('uiServerConfigurationIndex', 0)
+ ]
+ )
+ }
+ app.use(router).use(ToastPlugin).mount('#app')
+}
+