classic-ui-dev/components/governance/manage/tabs/RewardTab.vue
Danil Kovtonyuk 44f31f8b9f
init
2022-04-22 13:14:19 +10:00

44 lines
1.1 KiB
Vue

<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>