classic-ui/components/governance/manage/tabs/RewardTab.vue

44 lines
1.1 KiB
Vue
Raw Normal View History

2022-04-22 06:05:56 +03:00
<template>
<b-tab-item :label="$t('stakingReward.label.tab')">
<div class="p">
{{ $t('stakingReward.description') }}
</div>
<div class="label-with-value">
{{ $t('stakingReward.label.input') }}:
<span><number-format :value="reward" /> TORN</span>
</div>
<b-button :disabled="notAvailableClaim" type="is-primary is-fullwidth" outlined @click="onClaim">
{{ $t('stakingReward.action') }}
</b-button>
</b-tab-item>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
import { BigNumber as BN } from 'bignumber.js'
import NumberFormat from '@/components/NumberFormat'
export default {
components: {
NumberFormat
},
inject: ['close'],
computed: {
...mapGetters('governance/staking', ['reward']),
notAvailableClaim() {
return BN(this.reward).isZero()
}
},
methods: {
...mapActions('governance/staking', ['claimReward']),
async onClaim() {
this.$store.dispatch('loading/enable', { message: this.$t('preparingTransactionData') })
await this.claimReward()
this.$store.dispatch('loading/disable')
this.close()
}
}
}
</script>