aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/App.vue
diff options
context:
space:
mode:
authorBastien Wirtz <bastien.wirtz@gmail.com>2020-06-09 19:11:42 -0700
committerBastien Wirtz <bastien.wirtz@gmail.com>2020-06-09 21:55:29 -0700
commit1a42e30a1752be5ab0fba5b224fad5686f12499e (patch)
treed5fb02a4fda8eb0ffe30e32fa53b0212ff1d6d7c /src/App.vue
parent52ed5af6074bb6850925cbb658a60a4493079338 (diff)
downloadhomer-1a42e30a1752be5ab0fba5b224fad5686f12499e.tar.gz
homer-1a42e30a1752be5ab0fba5b224fad5686f12499e.tar.zst
homer-1a42e30a1752be5ab0fba5b224fad5686f12499e.zip
Adding external config support
Diffstat (limited to 'src/App.vue')
-rw-r--r--src/App.vue33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/App.vue b/src/App.vue
index fddc585..440ffa0 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -63,7 +63,7 @@
63 </h2> 63 </h2>
64 <Service 64 <Service
65 v-for="item in group.items" 65 v-for="item in group.items"
66 :key="item.url" 66 :key="item.name"
67 v-bind:item="item" 67 v-bind:item="item"
68 class="column is-one-third-widescreen" 68 class="column is-one-third-widescreen"
69 /> 69 />
@@ -153,19 +153,28 @@ export default {
153 document.title = `${this.config.title} | ${this.config.subtitle}`; 153 document.title = `${this.config.title} | ${this.config.subtitle}`;
154 }, 154 },
155 methods: { 155 methods: {
156 getConfig: function () { 156 getConfig: function (path = "config.yml") {
157 return fetch("config.yml") 157 return fetch(path).then((response) => {
158 .then((response) => { 158 if (!response.ok) {
159 if (!response.ok) { 159 throw Error(response.statusText);
160 throw Error(response.statusText); 160 }
161 } 161
162 return response.text().then((body) => { 162 const that = this;
163 return response
164 .text()
165 .then((body) => {
163 return jsyaml.load(body); 166 return jsyaml.load(body);
167 })
168 .then(function (config) {
169 if (config.externalConfig) {
170 return that.getConfig(config.externalConfig);
171 }
172 return config;
173 })
174 .catch((error) => {
175 return this.handleErrors("⚠️ Error loading configuration", error);
164 }); 176 });
165 }) 177 });
166 .catch((error) => {
167 return this.handleErrors("⚠️ Error loading configuration", error);
168 });
169 }, 178 },
170 matchesFilter: function (item) { 179 matchesFilter: function (item) {
171 return ( 180 return (