]> git.immae.eu Git - github/bastienwirtz/homer.git/commitdiff
Handle 404 error on config file. 421/head
authorBastien Wirtz <bastien.wirtz@gmail.com>
Sun, 10 Apr 2022 09:56:44 +0000 (11:56 +0200)
committerBastien Wirtz <bastien.wirtz@gmail.com>
Sat, 30 Apr 2022 13:39:36 +0000 (15:39 +0200)
src/App.vue
src/components/GetStarted.vue
src/components/services/Emby.vue

index 81f92f788f6bd63f4818b60b50c8525933a95ceb..515177eba13b80d096a89727781655114dadf35d 100644 (file)
             </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}`);
         }
index dcabc02a15439f9c1ac49430dfcf1dc8a2955f52..c256a0f9f09085a1e711eacf140b0706e92b8e81 100644 (file)
@@ -6,7 +6,7 @@
       <p>
         <a
           class="button is-primary mt-5 has-text-weight-bold"
-          href="https://github.com/bastienwirtz/homer/blob/main/README.md#getting-started"
+          href="https://github.com/bastienwirtz/homer/blob/main/docs/configuration.md#configuration"
           target="_blank"
         >
           Get started
index 25a26125acc00f54207ed27fc4892b54411fb2ea..d2411f067debed17a76e35106fe156b8ffd0e094 100644 (file)
@@ -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);