From 4f56c2c11baad8f98c338989fb0cd8e5af78d0c8 Mon Sep 17 00:00:00 2001 From: Bastien Wirtz Date: Sun, 10 Apr 2022 11:56:44 +0200 Subject: [PATCH] Handle 404 error on config file. --- src/App.vue | 18 ++++++++++++++++-- src/components/GetStarted.vue | 2 +- src/components/services/Emby.vue | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/App.vue b/src/App.vue index 81f92f7..515177e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -18,7 +18,10 @@ -
+
{{ config.subtitle }}

{{ config.title }}

@@ -61,7 +64,7 @@ @network-status-update="offline = $event" /> - +
@@ -168,6 +171,7 @@ export default { data: function () { return { loaded: false, + configNotFound: false, config: null, services: null, offline: false, @@ -177,6 +181,11 @@ export default { showMenu: false, }; }, + computed: { + configurationNeeded: function () { + return (this.loaded && !this.services) || this.configNotFound; + }, + }, created: async function () { this.buildDashboard(); window.onhashchange = this.buildDashboard; @@ -228,6 +237,11 @@ export default { return; } + if (response.status == 404) { + this.configNotFound = true; + return {}; + } + if (!response.ok) { throw Error(`${response.statusText}: ${response.body}`); } diff --git a/src/components/GetStarted.vue b/src/components/GetStarted.vue index dcabc02..c256a0f 100644 --- a/src/components/GetStarted.vue +++ b/src/components/GetStarted.vue @@ -6,7 +6,7 @@

Get started diff --git a/src/components/services/Emby.vue b/src/components/services/Emby.vue index 25a2612..d2411f0 100644 --- a/src/components/services/Emby.vue +++ b/src/components/services/Emby.vue @@ -62,7 +62,7 @@ export default { this.fetch("/System/info/public") .then((response) => { if (response.Id) this.status = "running"; - else throw new Error(); + else throw new Error(); }) .catch((e) => { console.log(e);