From 2fba043575e6a8db94434986c1781d2716c8f6d4 Mon Sep 17 00:00:00 2001
From: Bastien Wirtz <bastien.wirtz@gmail.com>
Date: Sun, 10 Oct 2021 10:37:20 +0200
Subject: Allow non json reponse in fetch.

---
 src/components/services/Ping.vue | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

(limited to 'src/components/services/Ping.vue')

diff --git a/src/components/services/Ping.vue b/src/components/services/Ping.vue
index 6fd3ec5..d1fda57 100644
--- a/src/components/services/Ping.vue
+++ b/src/components/services/Ping.vue
@@ -9,10 +9,12 @@
 </template>
 
 <script>
+import service from "@/mixins/service.js";
 import Generic from "./Generic.vue";
 
 export default {
   name: "Ping",
+  mixins: [service],
   props: {
     item: Object,
   },
@@ -27,16 +29,8 @@ export default {
   },
   methods: {
     fetchStatus: async function () {
-      const url = `${this.item.url}`;
-      fetch(url, {
-        method: "HEAD",
-        cache: "no-cache",
-        credentials: "include",
-      })
-        .then((response) => {
-          if (!response.ok) {
-            throw Error(response.statusText);
-          }
+      this.fetch("/", { method: "HEAD", cache: "no-cache" }, false)
+        .then(() => {
           this.status = "online";
         })
         .catch(() => {
-- 
cgit v1.2.3

