2020-11-10 00:33:55 +00:00
|
|
|
<template>
|
2021-01-21 14:32:13 +00:00
|
|
|
<q-card style="text-align: center">
|
2020-11-10 00:33:55 +00:00
|
|
|
<q-card-section>
|
|
|
|
<div class="text-h6">Gerücht: {{ balance.toFixed(2) }} €</div>
|
|
|
|
</q-card-section>
|
|
|
|
</q-card>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-02-04 01:44:20 +00:00
|
|
|
import { useMainStore } from 'src/store';
|
|
|
|
import { useBalanceStore } from '../store';
|
2021-01-30 03:16:17 +00:00
|
|
|
import { computed, defineComponent, onBeforeMount } from 'vue';
|
2020-11-10 00:33:55 +00:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: 'BalanceWidget',
|
2021-01-31 21:01:38 +00:00
|
|
|
setup() {
|
2021-02-04 01:44:20 +00:00
|
|
|
const store = useBalanceStore();
|
2021-02-04 23:07:51 +00:00
|
|
|
|
2020-11-10 00:33:55 +00:00
|
|
|
onBeforeMount(() => {
|
2021-02-04 01:44:20 +00:00
|
|
|
const mainStore = useMainStore();
|
|
|
|
void store.getBalance(mainStore.currentUser);
|
2020-11-10 00:33:55 +00:00
|
|
|
});
|
|
|
|
|
2021-02-04 01:44:20 +00:00
|
|
|
const balance = computed(() => store.balance?.balance || NaN);
|
2020-11-10 00:33:55 +00:00
|
|
|
|
|
|
|
return { balance };
|
2021-03-18 16:23:57 +00:00
|
|
|
},
|
2020-11-10 00:33:55 +00:00
|
|
|
});
|
|
|
|
</script>
|