Fixed balance widget

This commit is contained in:
Ferdinand Thiessen 2021-01-21 15:32:13 +01:00
parent 01143e08e8
commit 5028d46900
1 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
<template>
<q-card style="text-align: center;">
<q-card style="text-align: center">
<q-card-section>
<div class="text-h6">Gerücht: {{ balance.toFixed(2) }} </div>
</q-card-section>
@ -8,7 +8,7 @@
<script lang="ts">
import { computed, defineComponent, onBeforeMount } from '@vue/composition-api';
import { BalanceInterface } from 'src/plugins/balance/store/balance';
import { StateInterfaceBalance, UserBalance } from 'src/plugins/balance/store/balance';
import { Store } from 'vuex';
export default defineComponent({
@ -20,13 +20,13 @@ export default defineComponent({
});
});
const store: Store<{ balance: BalanceInterface }> = <
Store<{ balance: BalanceInterface }>
>root.$store;
const store = <Store<StateInterfaceBalance>>root.$store;
const balance = computed<number>(() => {
return store.state.balance.balance;
});
const balance = computed(
() =>
store.state.balance.balances.get((<FG.User>store.state.user.currentUser).userid)?.balance ||
NaN
);
return { balance };
}