]> git.immae.eu Git - github/bastienwirtz/homer.git/blobdiff - src/components/services/Radarr.vue
Radarr and Sonarr V3 api support optional
[github/bastienwirtz/homer.git] / src / components / services / Radarr.vue
index a57c895f0e0e9bc9e10b48f5ef5c08c3df837e1b..13f6d68840e0c7813ccf018abb56d9a85f81577c 100644 (file)
@@ -26,6 +26,9 @@
 import service from "@/mixins/service.js";
 import Generic from "./Generic.vue";
 
+const V3_API = "/api/v3";
+const LEGACY_API = "/api";
+
 export default {
   name: "Radarr",
   mixins: [service],
@@ -46,9 +49,14 @@ export default {
   created: function () {
     this.fetchConfig();
   },
+  computed: {
+    apiPath() {
+      return this.item.legacyApi ? LEGACY_API : V3_API;
+    },
+  },
   methods: {
     fetchConfig: function () {
-      this.fetch(`/api/health?apikey=${this.item.apikey}`)
+      this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`)
         .then((health) => {
           this.warnings = 0;
           this.errors = 0;
@@ -64,7 +72,7 @@ export default {
           console.error(e);
           this.serverError = true;
         });
-      this.fetch(`/api/queue?apikey=${this.item.apikey}`)
+      this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`)
         .then((queue) => {
           this.activity = 0;
           for (var i = 0; i < queue.length; i++) {