aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/services/Radarr.vue
diff options
context:
space:
mode:
authorDuy NGUYEN <duynguyen@deevotech.com>2022-02-01 17:05:23 +0100
committerDuy NGUYEN <duynguyen@deevotech.com>2022-02-01 17:05:23 +0100
commit8ede30411ed1726ed3885fd617364924e677abc2 (patch)
tree28ccd2b03b485450efdbe2d49484ae7f02837f9d /src/components/services/Radarr.vue
parentcb154a6818cd25a36298e307cb415b11e9bd2247 (diff)
downloadhomer-8ede30411ed1726ed3885fd617364924e677abc2.tar.gz
homer-8ede30411ed1726ed3885fd617364924e677abc2.tar.zst
homer-8ede30411ed1726ed3885fd617364924e677abc2.zip
Radarr and Sonarr V3 api support optional
Diffstat (limited to 'src/components/services/Radarr.vue')
-rw-r--r--src/components/services/Radarr.vue12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/components/services/Radarr.vue b/src/components/services/Radarr.vue
index a8c97c1..13f6d68 100644
--- a/src/components/services/Radarr.vue
+++ b/src/components/services/Radarr.vue
@@ -26,6 +26,9 @@
26import service from "@/mixins/service.js"; 26import service from "@/mixins/service.js";
27import Generic from "./Generic.vue"; 27import Generic from "./Generic.vue";
28 28
29const V3_API = "/api/v3";
30const LEGACY_API = "/api";
31
29export default { 32export default {
30 name: "Radarr", 33 name: "Radarr",
31 mixins: [service], 34 mixins: [service],
@@ -46,9 +49,14 @@ export default {
46 created: function () { 49 created: function () {
47 this.fetchConfig(); 50 this.fetchConfig();
48 }, 51 },
52 computed: {
53 apiPath() {
54 return this.item.legacyApi ? LEGACY_API : V3_API;
55 },
56 },
49 methods: { 57 methods: {
50 fetchConfig: function () { 58 fetchConfig: function () {
51 this.fetch(`/api/v3/health?apikey=${this.item.apikey}`) 59 this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`)
52 .then((health) => { 60 .then((health) => {
53 this.warnings = 0; 61 this.warnings = 0;
54 this.errors = 0; 62 this.errors = 0;
@@ -64,7 +72,7 @@ export default {
64 console.error(e); 72 console.error(e);
65 this.serverError = true; 73 this.serverError = true;
66 }); 74 });
67 this.fetch(`/api/v3/queue?apikey=${this.item.apikey}`) 75 this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`)
68 .then((queue) => { 76 .then((queue) => {
69 this.activity = 0; 77 this.activity = 0;
70 for (var i = 0; i < queue.length; i++) { 78 for (var i = 0; i < queue.length; i++) {