]> git.immae.eu Git - github/bastienwirtz/homer.git/blobdiff - src/components/services/PiHole.vue
include credentials while making fetch calls
[github/bastienwirtz/homer.git] / src / components / services / PiHole.vue
index 03d3ae30e1d90495858bb59d6eb87b066f1d6d92..ce0b68928afffa11aad883e342afce099b58e420 100644 (file)
                 <template v-if="item.subtitle">
                   {{ item.subtitle }}
                 </template>
-                <template v-else-if="status">
+                <template v-else-if="api">
                   {{ percentage }}&percnt; blocked
                 </template>
               </p>
             </div>
-            <div v-if="status" class="status" :class="status.status">
-              {{ status.status }}
+            <div v-if="api" class="status" :class="api.status">
+              {{ api.status }}
             </div>
           </div>
           <div class="tag" :class="item.tagstyle" v-if="item.tag">
@@ -45,15 +45,15 @@ export default {
     item: Object,
   },
   data: () => ({
-    status: {
+    api: {
       status: "",
       ads_percentage_today: 0,
     },
   }),
   computed: {
     percentage: function () {
-      if (this.status) {
-        return this.status.ads_percentage_today.toFixed(1);
+      if (this.api) {
+        return this.api.ads_percentage_today.toFixed(1);
       }
       return "";
     },
@@ -64,7 +64,9 @@ export default {
   methods: {
     fetchStatus: async function () {
       const url = `${this.item.url}/api.php`;
-      this.status = await fetch(url)
+      this.api = await fetch(url{
+        credentials: 'include'
+      })
         .then((response) => response.json())
         .catch((e) => console.log(e));
     },
@@ -83,13 +85,13 @@ export default {
   &.enabled:before {
     background-color: #94e185;
     border-color: #78d965;
-    box-shadow: 0 0 4px 1px #94e185;
+    box-shadow: 0 0 5px 1px #94e185;
   }
 
   &.disabled:before {
     background-color: #c9404d;
     border-color: #c42c3b;
-    box-shadow: 0 0 4px 1px #c9404d;
+    box-shadow: 0 0 5px 1px #c9404d;
   }
 
   &:before {