Fixed wrongly removed computed property

This commit is contained in:
Bram Ceulemans 2020-12-10 00:07:53 +01:00
parent f81dc6f488
commit 4ce53b68ea

View File

@ -20,13 +20,13 @@
<template v-if="item.subtitle"> <template v-if="item.subtitle">
{{ item.subtitle }} {{ item.subtitle }}
</template> </template>
<template v-else-if="status"> <template v-else-if="api">
{{ percentage }}&percnt; blocked {{ percentage }}&percnt; blocked
</template> </template>
</p> </p>
</div> </div>
<div v-if="status" class="status" :class="status.status"> <div v-if="api" class="status" :class="api.status">
{{ status.status }} {{ api.status }}
</div> </div>
</div> </div>
<div class="tag" :class="item.tagstyle" v-if="item.tag"> <div class="tag" :class="item.tagstyle" v-if="item.tag">
@ -45,15 +45,15 @@ export default {
item: Object, item: Object,
}, },
data: () => ({ data: () => ({
status: { api: {
status: "", status: "",
ads_percentage_today: 0, ads_percentage_today: 0,
}, },
}), }),
computed: { computed: {
percentage: function () { percentage: function () {
if (this.status) { if (this.api) {
return this.status.ads_percentage_today.toFixed(1); return this.api.ads_percentage_today.toFixed(1);
} }
return ""; return "";
}, },
@ -64,7 +64,7 @@ export default {
methods: { methods: {
fetchStatus: async function () { fetchStatus: async function () {
const url = `${this.item.url}/api.php`; const url = `${this.item.url}/api.php`;
this.status = await fetch(url) this.api = await fetch(url)
.then((response) => response.json()) .then((response) => response.json())
.catch((e) => console.log(e)); .catch((e) => console.log(e));
}, },