From d362add383b622c4b941e8bdd02b741393c65bd0 Mon Sep 17 00:00:00 2001
From: Floren Munteanu <fmunteanu@users.noreply.github.com>
Date: Sun, 19 Feb 2023 15:18:56 -0500
Subject: Implement PiHole API token (#580)

Implement PiHole API token
---
 src/components/services/PiHole.vue | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/components/services/PiHole.vue b/src/components/services/PiHole.vue
index 9aac016..237cb12 100644
--- a/src/components/services/PiHole.vue
+++ b/src/components/services/PiHole.vue
@@ -49,7 +49,11 @@ export default {
   },
   methods: {
     fetchStatus: async function () {
-      const result = await this.fetch("/api.php").catch((e) => console.log(e));
+      const authQueryParams = this.item.apikey
+        ? `?summaryRaw&auth=${this.item.apikey}`
+        : "";
+      const result = await this.fetch(`/api.php${authQueryParams}`)
+        .catch((e) => console.log(e));
 
       this.status = result.status;
       this.ads_percentage_today = result.ads_percentage_today;
-- 
cgit v1.2.3