]> git.immae.eu Git - github/bastienwirtz/homer.git/blobdiff - src/components/ConnectivityChecker.vue
Adds total count for VMs.
[github/bastienwirtz/homer.git] / src / components / ConnectivityChecker.vue
index 0d7e79fb475950d4f1a6dd21c8d62e3d283ca9fc..0e724fc6d59ced9c8077bd71ca29a2ec381bae9f 100644 (file)
@@ -35,7 +35,7 @@ export default {
     window.addEventListener(
       "online",
       function () {
-          that.checkOffline();
+        that.checkOffline();
       },
       false
     );
@@ -56,15 +56,21 @@ export default {
 
       // extra check to make sure we're not offline
       let that = this;
-      return fetch(window.location.href + "?alive", {
+      const aliveCheckUrl = `${window.location.origin}${
+        window.location.pathname
+      }/index.html?t=${new Date().valueOf()}`;
+      return fetch(aliveCheckUrl, {
         method: "HEAD",
         cache: "no-store",
-        redirect: "manual"
+        redirect: "manual",
       })
         .then(function (response) {
           // opaqueredirect means request has been redirected, to auth provider probably
-          if ((response.type === "opaqueredirect" && !response.ok) || [401, 403].indexOf(response.status) != -1) {
-            window.location.href = window.location.href + "?t="+(new Date().valueOf());
+          if (
+            (response.type === "opaqueredirect" && !response.ok) ||
+            [401, 403].indexOf(response.status) != -1
+          ) {
+            window.location.href = aliveCheckUrl;
           }
           that.offline = !response.ok;
         })