From 4f56c2c11baad8f98c338989fb0cd8e5af78d0c8 Mon Sep 17 00:00:00 2001
From: Bastien Wirtz <bastien.wirtz@gmail.com>
Date: Sun, 10 Apr 2022 11:56:44 +0200
Subject: Handle 404 error on config file.

---
 src/App.vue | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

(limited to 'src/App.vue')

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 @@
             </a>
             <i v-if="config.icon" :class="config.icon"></i>
           </div>
-          <div class="dashboard-title">
+          <div
+            class="dashboard-title"
+            :class="{ 'no-logo': !config.icon || !config.logo }"
+          >
             <span class="headline">{{ config.subtitle }}</span>
             <h1>{{ config.title }}</h1>
           </div>
@@ -61,7 +64,7 @@
           @network-status-update="offline = $event"
         />
 
-        <GetStarted v-if="loaded && !services" />
+        <GetStarted v-if="configurationNeeded" />
 
         <div v-if="!offline">
           <!-- Optional messages -->
@@ -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}`);
         }
-- 
cgit v1.2.3

