aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/services')
-rw-r--r--src/components/services/AdGuardHome.vue18
-rw-r--r--src/components/services/Ping.vue14
2 files changed, 12 insertions, 20 deletions
diff --git a/src/components/services/AdGuardHome.vue b/src/components/services/AdGuardHome.vue
index 16881fa..b01f0f4 100644
--- a/src/components/services/AdGuardHome.vue
+++ b/src/components/services/AdGuardHome.vue
@@ -20,10 +20,12 @@
20</template> 20</template>
21 21
22<script> 22<script>
23import service from "@/mixins/service.js";
23import Generic from "./Generic.vue"; 24import Generic from "./Generic.vue";
24 25
25export default { 26export default {
26 name: "AdGuardHome", 27 name: "AdGuardHome",
28 mixins: [service],
27 props: { 29 props: {
28 item: Object, 30 item: Object,
29 }, 31 },
@@ -60,18 +62,14 @@ export default {
60 }, 62 },
61 methods: { 63 methods: {
62 fetchStatus: async function () { 64 fetchStatus: async function () {
63 this.status = await fetch(`${this.item.url}/control/status`, { 65 this.status = await this.fetch("/control/status").catch((e) =>
64 credentials: "include", 66 console.log(e)
65 }) 67 );
66 .then((response) => response.json())
67 .catch((e) => console.log(e));
68 }, 68 },
69 fetchStats: async function () { 69 fetchStats: async function () {
70 this.stats = await fetch(`${this.item.url}/control/stats`, { 70 this.stats = await this.fetch("/control/stats").catch((e) =>
71 credentials: "include", 71 console.log(e)
72 }) 72 );
73 .then((response) => response.json())
74 .catch((e) => console.log(e));
75 }, 73 },
76 }, 74 },
77}; 75};
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 @@
9</template> 9</template>
10 10
11<script> 11<script>
12import service from "@/mixins/service.js";
12import Generic from "./Generic.vue"; 13import Generic from "./Generic.vue";
13 14
14export default { 15export default {
15 name: "Ping", 16 name: "Ping",
17 mixins: [service],
16 props: { 18 props: {
17 item: Object, 19 item: Object,
18 }, 20 },
@@ -27,16 +29,8 @@ export default {
27 }, 29 },
28 methods: { 30 methods: {
29 fetchStatus: async function () { 31 fetchStatus: async function () {
30 const url = `${this.item.url}`; 32 this.fetch("/", { method: "HEAD", cache: "no-cache" }, false)
31 fetch(url, { 33 .then(() => {
32 method: "HEAD",
33 cache: "no-cache",
34 credentials: "include",
35 })
36 .then((response) => {
37 if (!response.ok) {
38 throw Error(response.statusText);
39 }
40 this.status = "online"; 34 this.status = "online";
41 }) 35 })
42 .catch(() => { 36 .catch(() => {