import axios from 'axios';
import Vue, { ComponentOptions } from 'vue';
import vueCustomElement from 'vue-custom-element';

Vue.use(vueCustomElement);

export interface HueComponentOptions<T extends Vue> extends ComponentOptions<T> {
  hueBaseUrl?: string;
}

export const wrap = <T extends Vue>(tag: string, component: { new (): T }): void => {
  Vue.customElement(tag, new component().$options, {
    connectedCallback() {
      const element = <HTMLElement>this;
      const hueBaseUrl = element.getAttribute('hue-base-url');
      if (hueBaseUrl) {
        axios.defaults.baseURL = hueBaseUrl;
      }
    }
  });
};

import Vue from 'vue';
import vueCustomElement from 'vue-custom-element';

Vue.use(vueCustomElement);

export const wrap = <T extends Vue>(tag: string, component: { new (): T }): void => {
  Vue.customElement(tag, new component().$options);
};

--- 
+++ 
@@ -1,8 +1,21 @@
-import Vue from 'vue';
+import axios from 'axios';
+import Vue, { ComponentOptions } from 'vue';
 import vueCustomElement from 'vue-custom-element';
 
 Vue.use(vueCustomElement);
 
+export interface HueComponentOptions<T extends Vue> extends ComponentOptions<T> {
+  hueBaseUrl?: string;
+}
+
 export const wrap = <T extends Vue>(tag: string, component: { new (): T }): void => {
-  Vue.customElement(tag, new component().$options);
+  Vue.customElement(tag, new component().$options, {
+    connectedCallback() {
+      const element = <HTMLElement>this;
+      const hueBaseUrl = element.getAttribute('hue-base-url');
+      if (hueBaseUrl) {
+        axios.defaults.baseURL = hueBaseUrl;
+      }
+    }
+  });
 };
[frontend] Add global web component attribute for hue base URL config

For now just for axios requests
