]> git.immae.eu Git - github/bastienwirtz/homer.git/blobdiff - src/components/ConnectivityChecker.vue
Fix ConnectivityChecker to evaluate the response status codes.
[github/bastienwirtz/homer.git] / src / components / ConnectivityChecker.vue
index a91a8098457710423df60d74cf676c1f23a25f0b..7302e1f56a5ea91504c62e506736b3337a3aa752 100644 (file)
@@ -2,7 +2,7 @@
   <div v-if="offline" class="offline-message">
     <i class="far fa-dizzy"></i>
     <h1>
-      You're offline bro.
+      You're offline friend.
       <span @click="checkOffline"> <i class="fas fa-redo-alt"></i></span>
     </h1>
   </div>
@@ -37,14 +37,18 @@ export default {
         method: "HEAD",
         cache: "no-store",
       })
-        .then(function () {
-          that.offline = false;
+        .then(function (response) {
+          if (response.status >= 200 && response.status < 300) {
+            that.offline = false;
+          } else {
+            that.offline = true;
+          }
         })
         .catch(function () {
           that.offline = true;
         })
         .finally(function () {
-          that.$emit("network:status-update", that.offline);
+          that.$emit("network-status-update", that.offline);
         });
     },
   },