aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/services/Sonarr.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/Sonarr.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/Sonarr.vue')
-rw-r--r--src/components/services/Sonarr.vue12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/components/services/Sonarr.vue b/src/components/services/Sonarr.vue
index 972a1c9..3e5c49f 100644
--- a/src/components/services/Sonarr.vue
+++ b/src/components/services/Sonarr.vue
@@ -27,6 +27,9 @@
27import service from "@/mixins/service.js"; 27import service from "@/mixins/service.js";
28import Generic from "./Generic.vue"; 28import Generic from "./Generic.vue";
29 29
30const V3_API = "/api/v3";
31const LEGACY_API = "/api";
32
30export default { 33export default {
31 name: "Sonarr", 34 name: "Sonarr",
32 mixins: [service], 35 mixins: [service],
@@ -36,6 +39,11 @@ export default {
36 components: { 39 components: {
37 Generic, 40 Generic,
38 }, 41 },
42 computed: {
43 apiPath() {
44 return this.item.legacyApi ? LEGACY_API : V3_API;
45 },
46 },
39 data: () => { 47 data: () => {
40 return { 48 return {
41 activity: null, 49 activity: null,
@@ -49,7 +57,7 @@ export default {
49 }, 57 },
50 methods: { 58 methods: {
51 fetchConfig: function () { 59 fetchConfig: function () {
52 this.fetch(`/api/v3/health?apikey=${this.item.apikey}`) 60 this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`)
53 .then((health) => { 61 .then((health) => {
54 this.warnings = 0; 62 this.warnings = 0;
55 this.errors = 0; 63 this.errors = 0;
@@ -65,7 +73,7 @@ export default {
65 console.error(e); 73 console.error(e);
66 this.serverError = true; 74 this.serverError = true;
67 }); 75 });
68 this.fetch(`/api/v3/queue?apikey=${this.item.apikey}`) 76 this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`)
69 .then((queue) => { 77 .then((queue) => {
70 this.activity = 0; 78 this.activity = 0;
71 for (var i = 0; i < queue.length; i++) { 79 for (var i = 0; i < queue.length; i++) {