X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FApp.vue;h=d97df0cc18d1f5ad5ff1af3ba5f8c8b1a059619c;hb=d1b29caaa62ef19e9dd68babf334ec25a966f945;hp=fddc5853a6f20acbbf961a520313192b9ba8f057;hpb=bd9109425a40f5b6c43147a7c9852014a5797dca;p=github%2Fbastienwirtz%2Fhomer.git diff --git a/src/App.vue b/src/App.vue index fddc585..d97df0c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -26,7 +26,7 @@ @@ -40,16 +40,19 @@
- +
@@ -58,14 +61,14 @@
@@ -76,12 +79,12 @@ class="columns is-multiline layout-vertical" >

- + {{ group.name }}

{ - if (!response.ok) { - throw Error(response.statusText); - } - return response.text().then((body) => { + getConfig: function (path = "assets/config.yml") { + return fetch(path).then((response) => { + if (response.redirected) { + // This allows to work with authentication proxies. + window.location.href = response.url; + return; + } + if (!response.ok) { + throw Error(`${response.statusText}: ${response.body}`); + } + + const that = this; + return response + .text() + .then((body) => { return jsyaml.load(body); + }) + .then(function (config) { + if (config.externalConfig) { + return that.getConfig(config.externalConfig); + } + return config; }); - }) - .catch((error) => { - return this.handleErrors("⚠️ Error loading configuration", error); - }); + }); }, matchesFilter: function (item) { return ( @@ -215,6 +244,11 @@ export default { }, }; }, + createStylesheet: function (css) { + let style = document.createElement("style"); + style.appendChild(document.createTextNode(css)); + document.head.appendChild(style); + }, }, };