Fixed balance widget
This commit is contained in:
parent
01143e08e8
commit
5028d46900
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<q-card style="text-align: center;">
|
<q-card style="text-align: center">
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div class="text-h6">Gerücht: {{ balance.toFixed(2) }} €</div>
|
<div class="text-h6">Gerücht: {{ balance.toFixed(2) }} €</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, onBeforeMount } from '@vue/composition-api';
|
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';
|
import { Store } from 'vuex';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -20,13 +20,13 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const store: Store<{ balance: BalanceInterface }> = <
|
const store = <Store<StateInterfaceBalance>>root.$store;
|
||||||
Store<{ balance: BalanceInterface }>
|
|
||||||
>root.$store;
|
|
||||||
|
|
||||||
const balance = computed<number>(() => {
|
const balance = computed(
|
||||||
return store.state.balance.balance;
|
() =>
|
||||||
});
|
store.state.balance.balances.get((<FG.User>store.state.user.currentUser).userid)?.balance ||
|
||||||
|
NaN
|
||||||
|
);
|
||||||
|
|
||||||
return { balance };
|
return { balance };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue