Watch updats in home component

This commit is contained in:
Torjus Håkestad 2021-04-11 11:44:20 +02:00
parent b1785f419a
commit 4c55f6571a

View File

@ -38,7 +38,7 @@
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { Component, Vue, Watch } from 'vue-property-decorator';
import axios from 'axios';
type TotalStatsHeaders =
@ -57,6 +57,7 @@ interface TotalStatsResult {
export default class Home extends Vue {
totalStats?: TotalStatsResult[];
@Watch('totalStats')
getStat(key: TotalStatsHeaders): string | undefined {
const result = this.totalStats?.find((elem) => elem.name === key);
if (result) {