aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/App.vue42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/App.vue b/src/App.vue
index 8185da2..fddc585 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -146,27 +146,26 @@ export default {
146 }; 146 };
147 }, 147 },
148 created: async function () { 148 created: async function () {
149 try { 149 const defaults = jsyaml.load(defaultConfig);
150 const defaults = jsyaml.load(defaultConfig); 150 let config = await this.getConfig();
151 let config = await this.getConfig(); 151 this.config = merge(defaults, config);
152 152 this.services = this.config.services;
153 this.config = merge(defaults, config); 153 document.title = `${this.config.title} | ${this.config.subtitle}`;
154 this.services = this.config.services;
155 document.title = `${this.config.title} | ${this.config.subtitle}`;
156 } catch (error) {
157 this.offline = true;
158 }
159 }, 154 },
160 methods: { 155 methods: {
161 getConfig: function () { 156 getConfig: function () {
162 return fetch("config.yml").then(function (response) { 157 return fetch("config.yml")
163 if (response.status != 200) { 158 .then((response) => {
164 return; 159 if (!response.ok) {
165 } 160 throw Error(response.statusText);
166 return response.text().then(function (body) { 161 }
167 return jsyaml.load(body); 162 return response.text().then((body) => {
163 return jsyaml.load(body);
164 });
165 })
166 .catch((error) => {
167 return this.handleErrors("⚠️ Error loading configuration", error);
168 }); 168 });
169 });
170 }, 169 },
171 matchesFilter: function (item) { 170 matchesFilter: function (item) {
172 return ( 171 return (
@@ -207,6 +206,15 @@ export default {
207 }, 206 },
208 ]; 207 ];
209 }, 208 },
209 handleErrors: function (title, content) {
210 return {
211 message: {
212 title: title,
213 style: "is-danger",
214 content: content,
215 },
216 };
217 },
210 }, 218 },
211}; 219};
212</script> 220</script>