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">
{{ 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,7 @@ export default {
methods: {
fetchStatus: async function () {
const url = `${this.item.url}/api.php`;
this.status = await fetch(url)
this.api = await fetch(url)
.then((response) => response.json())
.catch((e) => console.log(e));
},