diff options
author | royto <royto81+github@gmail.com> | 2023-08-06 22:46:36 +0200 |
---|---|---|
committer | Bastien Wirtz <bastien.wirtz@gmail.com> | 2023-08-08 12:48:44 -0700 |
commit | 018344d9116b506c662ecdcee2d0d505c857f1cf (patch) | |
tree | 1482ee815eba6549d1132b5c5c29597e9cf888d8 | |
parent | 16d3f4f53a4f4be77ace6f4f140e2e639ee761d9 (diff) | |
download | homer-018344d9116b506c662ecdcee2d0d505c857f1cf.tar.gz homer-018344d9116b506c662ecdcee2d0d505c857f1cf.tar.zst homer-018344d9116b506c662ecdcee2d0d505c857f1cf.zip |
PR review: use API const and lint
-rw-r--r-- | src/components/services/Readarr.vue | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/components/services/Readarr.vue b/src/components/services/Readarr.vue index d921c29..6ac6be2 100644 --- a/src/components/services/Readarr.vue +++ b/src/components/services/Readarr.vue | |||
@@ -52,29 +52,24 @@ export default { | |||
52 | created: function () { | 52 | created: function () { |
53 | this.fetchConfig(); | 53 | this.fetchConfig(); |
54 | }, | 54 | }, |
55 | computed: { | ||
56 | apiPath() { | ||
57 | return API; | ||
58 | }, | ||
59 | }, | ||
60 | methods: { | 55 | methods: { |
61 | fetchConfig: function () { | 56 | fetchConfig: function () { |
62 | const handleError = (e) => { | 57 | const handleError = (e) => { |
63 | console.error(e); | 58 | console.error(e); |
64 | this.serverError = true; | 59 | this.serverError = true; |
65 | } | 60 | }; |
66 | this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`) | 61 | this.fetch(`${API}/health?apikey=${this.item.apikey}`) |
67 | .then((health) => { | 62 | .then((health) => { |
68 | this.warnings = health.filter(h => h.type === 'warning').length; | 63 | this.warnings = health.filter((h) => h.type === "warning").length; |
69 | this.errors = health.filter(h => h.type === 'errors').length; | 64 | this.errors = health.filter((h) => h.type === "errors").length; |
70 | }) | 65 | }) |
71 | .catch(handleError); | 66 | .catch(handleError); |
72 | this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`) | 67 | this.fetch(`${API}/queue?apikey=${this.item.apikey}`) |
73 | .then((queue) => { | 68 | .then((queue) => { |
74 | this.activity = queue.totalRecords; | 69 | this.activity = queue.totalRecords; |
75 | }) | 70 | }) |
76 | .catch(handleError); | 71 | .catch(handleError); |
77 | this.fetch(`${this.apiPath}/wanted/missing?apikey=${this.item.apikey}`) | 72 | this.fetch(`${API}/wanted/missing?apikey=${this.item.apikey}`) |
78 | .then((missing) => { | 73 | .then((missing) => { |
79 | this.missing = missing.totalRecords; | 74 | this.missing = missing.totalRecords; |
80 | }) | 75 | }) |