Add ready property to home

This commit is contained in:
Torjus Håkestad 2021-04-11 11:54:37 +02:00
parent b52b519c5e
commit 0e6679d628

View File

@ -1,6 +1,6 @@
<template>
<div class="home">
<b-container v-if="totalStats">
<b-container v-if="ready">
<b-row>
<b-col class="total-title">
<h2>Total login attempts</h2>
@ -57,6 +57,8 @@ interface TotalStatsResult {
export default class Home extends Vue {
totalStats?: TotalStatsResult[];
ready = false;
@Watch('totalStats', { immediate: true, deep: true })
getStat(key: TotalStatsHeaders): string | undefined {
const result = this.totalStats?.find((elem) => elem.name === key);
@ -72,6 +74,7 @@ export default class Home extends Vue {
.get<TotalStatsResult[]>(url)
.then((resp) => {
this.totalStats = resp.data;
this.ready = true;
console.log(this.totalStats);
})
.catch((e) => {