decay is the balance shown, max 5 transactions in overview

This commit is contained in:
Moriz Wahl 2021-05-06 14:43:27 +02:00
parent ed554073dc
commit 449018a3a3
5 changed files with 10 additions and 15 deletions

View File

@ -79,6 +79,7 @@ export default {
balance: 0,
GdtBalance: 0,
transactions: [],
bookedBalance: 0,
}
},
methods: {
@ -94,19 +95,13 @@ export default {
this.$store.dispatch('logout')
this.$router.push('/login')
},
async loadBalance() {
const result = await communityAPI.balance(this.$store.state.session_id)
if (result.success) {
this.balance = result.result.data.balance // / 10000
} else {
// what to do when loading balance fails?
}
},
async updateTransactions() {
const result = await communityAPI.transactions(this.$store.state.session_id)
if (result.success) {
this.GdtBalance = result.result.data.gdtSum // / 10000
this.GdtBalance = Number(result.result.data.gdtSum)
this.transactions = result.result.data.transactions
this.balance = Number(result.result.data.decay)
this.bookedBalance = Number(result.result.data.balance)
} else {
// what to do when loading balance fails?
}
@ -119,7 +114,6 @@ export default {
this.initScrollbar()
},
created() {
this.loadBalance()
this.updateTransactions()
},
}

View File

@ -14,6 +14,7 @@
<gdd-table
v-if="showTransactionList"
:transactions="transactions"
:max="5"
@update-transactions="updateTransactions"
/>
</b-container>

View File

@ -255,7 +255,7 @@ export default {
this.$store.state.session_id,
this.ajaxCreateData.email,
// better to send the user's input here?
this.ajaxCreateData.amount * 10000,
this.ajaxCreateData.amount,
this.ajaxCreateData.memo,
this.ajaxCreateData.target_date,
)

View File

@ -1,6 +1,6 @@
<template>
<div>
<b-row v-show="showTransactionList">
<b-row>
<b-col col="6">
<stats-card
type="gradient-red"

View File

@ -1,8 +1,8 @@
<template>
<div>
<b-list-group v-show="showTransactionList">
<b-list-group>
<b-list-group-item
v-for="item in transactions"
v-for="item in transactions.slice(0, max)"
:key="item.id"
style="background-color: #ebebeba3 !important"
>
@ -106,8 +106,8 @@
export default {
name: 'GddTable',
props: {
showTransactionList: { type: Boolean, default: true },
transactions: { default: [] },
max: { type: Number, default: 25 },
},
data() {
return {