diff options
author | Bastien Wirtz <bastien.wirtz@gmail.com> | 2022-04-10 11:56:44 +0200 |
---|---|---|
committer | Bastien Wirtz <bastien.wirtz@gmail.com> | 2022-04-30 15:39:36 +0200 |
commit | 4f56c2c11baad8f98c338989fb0cd8e5af78d0c8 (patch) | |
tree | 971b362eb335628d818a3faf14ba4a6d9749d850 /src | |
parent | 049f85221e945b90bf87d21afe4d306839d65740 (diff) | |
download | homer-4f56c2c11baad8f98c338989fb0cd8e5af78d0c8.tar.gz homer-4f56c2c11baad8f98c338989fb0cd8e5af78d0c8.tar.zst homer-4f56c2c11baad8f98c338989fb0cd8e5af78d0c8.zip |
Handle 404 error on config file.
Diffstat (limited to 'src')
-rw-r--r-- | src/App.vue | 18 | ||||
-rw-r--r-- | src/components/GetStarted.vue | 2 | ||||
-rw-r--r-- | 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 @@ | |||
18 | </a> | 18 | </a> |
19 | <i v-if="config.icon" :class="config.icon"></i> | 19 | <i v-if="config.icon" :class="config.icon"></i> |
20 | </div> | 20 | </div> |
21 | <div class="dashboard-title"> | 21 | <div |
22 | class="dashboard-title" | ||
23 | :class="{ 'no-logo': !config.icon || !config.logo }" | ||
24 | > | ||
22 | <span class="headline">{{ config.subtitle }}</span> | 25 | <span class="headline">{{ config.subtitle }}</span> |
23 | <h1>{{ config.title }}</h1> | 26 | <h1>{{ config.title }}</h1> |
24 | </div> | 27 | </div> |
@@ -61,7 +64,7 @@ | |||
61 | @network-status-update="offline = $event" | 64 | @network-status-update="offline = $event" |
62 | /> | 65 | /> |
63 | 66 | ||
64 | <GetStarted v-if="loaded && !services" /> | 67 | <GetStarted v-if="configurationNeeded" /> |
65 | 68 | ||
66 | <div v-if="!offline"> | 69 | <div v-if="!offline"> |
67 | <!-- Optional messages --> | 70 | <!-- Optional messages --> |
@@ -168,6 +171,7 @@ export default { | |||
168 | data: function () { | 171 | data: function () { |
169 | return { | 172 | return { |
170 | loaded: false, | 173 | loaded: false, |
174 | configNotFound: false, | ||
171 | config: null, | 175 | config: null, |
172 | services: null, | 176 | services: null, |
173 | offline: false, | 177 | offline: false, |
@@ -177,6 +181,11 @@ export default { | |||
177 | showMenu: false, | 181 | showMenu: false, |
178 | }; | 182 | }; |
179 | }, | 183 | }, |
184 | computed: { | ||
185 | configurationNeeded: function () { | ||
186 | return (this.loaded && !this.services) || this.configNotFound; | ||
187 | }, | ||
188 | }, | ||
180 | created: async function () { | 189 | created: async function () { |
181 | this.buildDashboard(); | 190 | this.buildDashboard(); |
182 | window.onhashchange = this.buildDashboard; | 191 | window.onhashchange = this.buildDashboard; |
@@ -228,6 +237,11 @@ export default { | |||
228 | return; | 237 | return; |
229 | } | 238 | } |
230 | 239 | ||
240 | if (response.status == 404) { | ||
241 | this.configNotFound = true; | ||
242 | return {}; | ||
243 | } | ||
244 | |||
231 | if (!response.ok) { | 245 | if (!response.ok) { |
232 | throw Error(`${response.statusText}: ${response.body}`); | 246 | throw Error(`${response.statusText}: ${response.body}`); |
233 | } | 247 | } |
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 @@ | |||
6 | <p> | 6 | <p> |
7 | <a | 7 | <a |
8 | class="button is-primary mt-5 has-text-weight-bold" | 8 | class="button is-primary mt-5 has-text-weight-bold" |
9 | href="https://github.com/bastienwirtz/homer/blob/main/README.md#getting-started" | 9 | href="https://github.com/bastienwirtz/homer/blob/main/docs/configuration.md#configuration" |
10 | target="_blank" | 10 | target="_blank" |
11 | > | 11 | > |
12 | Get started | 12 | 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 { | |||
62 | this.fetch("/System/info/public") | 62 | this.fetch("/System/info/public") |
63 | .then((response) => { | 63 | .then((response) => { |
64 | if (response.Id) this.status = "running"; | 64 | if (response.Id) this.status = "running"; |
65 | else throw new Error(); | 65 | else throw new Error(); |
66 | }) | 66 | }) |
67 | .catch((e) => { | 67 | .catch((e) => { |
68 | console.log(e); | 68 | console.log(e); |