mirror of
https://github.com/tornadocash/tornado-classic-ui
synced 2024-02-02 15:04:09 +01:00
46 lines
1016 B
Vue
46 lines
1016 B
Vue
<template>
|
|
<div class="main">
|
|
<Metrics />
|
|
<nuxt-child />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapActions, mapState, mapGetters } from 'vuex'
|
|
import Metrics from '@/components/governance/Metrics'
|
|
|
|
export default {
|
|
middleware({ store, error }) {
|
|
if (!store.getters['governance/gov/isEnabledGovernance']) {
|
|
return error({ statusCode: 204, pageName: 'governance' })
|
|
}
|
|
},
|
|
components: {
|
|
Metrics
|
|
},
|
|
computed: {
|
|
...mapState('metamask', ['isInitialized']),
|
|
...mapGetters('governance/gov', ['isEnabledGovernance'])
|
|
},
|
|
watch: {
|
|
isInitialized: {
|
|
handler() {
|
|
if (this.isEnabledGovernance) {
|
|
this.fetchProposals({})
|
|
this.fetchConstants()
|
|
}
|
|
},
|
|
immediate: true
|
|
},
|
|
isEnabledGovernance(isEnabled) {
|
|
if (!isEnabled) {
|
|
this.$nuxt.error({ statusCode: 204, pageName: 'governance' })
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
...mapActions('governance/gov', ['fetchProposals', 'fetchConstants'])
|
|
}
|
|
}
|
|
</script>
|