11import { acceptHMRUpdate , defineStore } from "pinia" ;
22import { computed , ref } from "vue" ;
3+ import { getDefaultConfig } from "@/defaultConfig" ;
34
45export const useServiceControlStore = defineStore ( "ServiceControlStore" , ( ) => {
56 const serviceControlUrl = ref < string | null > ( ) ;
@@ -26,10 +27,11 @@ export const useServiceControlStore = defineStore("ServiceControlStore", () => {
2627 function refresh ( ) {
2728 const params = new URLSearchParams ( window . location . search ) ;
2829 const mu = params . get ( "mu" ) ;
30+ const config = getDefaultConfig ( ) ;
2931
30- if ( window . defaultConfig && window . defaultConfig . service_control_url ) {
31- serviceControlUrl . value = window . defaultConfig . service_control_url ;
32- console . debug ( `setting ServiceControl Url to its default value: ${ window . defaultConfig . service_control_url } ` ) ;
32+ if ( config . service_control_url ) {
33+ serviceControlUrl . value = config . service_control_url ;
34+ console . debug ( `setting ServiceControl Url to its default value: ${ config . service_control_url } ` ) ;
3335 } else {
3436 console . warn ( "ServiceControl Url is not defined." ) ;
3537 }
@@ -41,9 +43,9 @@ export const useServiceControlStore = defineStore("ServiceControlStore", () => {
4143 } else if ( window . localStorage . getItem ( "mu" ) ) {
4244 monitoringUrl . value = window . localStorage . getItem ( "mu" ) ;
4345 console . debug ( `Monitoring Url, not in QS, found in local storage: ${ monitoringUrl . value } ` ) ;
44- } else if ( window . defaultConfig && window . defaultConfig . monitoring_urls && window . defaultConfig . monitoring_urls . length ) {
45- monitoringUrl . value = window . defaultConfig . monitoring_urls [ 0 ] ;
46- console . debug ( `setting Monitoring Url to its default value: ${ window . defaultConfig . monitoring_urls [ 0 ] } ` ) ;
46+ } else if ( config . monitoring_url ) {
47+ monitoringUrl . value = config . monitoring_url ;
48+ console . debug ( `setting Monitoring Url to its default value: ${ config . monitoring_url } ` ) ;
4749 } else {
4850 console . warn ( "Monitoring Url is not defined." ) ;
4951 }
0 commit comments