2022-04-22 05:05:56 +02:00
|
|
|
<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']) {
|
2022-05-27 11:28:20 +02:00
|
|
|
return error({ statusCode: 204, pageName: 'governance' })
|
2022-04-22 05:05:56 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
Metrics
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState('metamask', ['isInitialized']),
|
|
|
|
...mapGetters('governance/gov', ['isEnabledGovernance'])
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
isInitialized: {
|
|
|
|
handler() {
|
2022-05-27 11:28:20 +02:00
|
|
|
if (this.isEnabledGovernance) {
|
|
|
|
this.fetchProposals({})
|
|
|
|
this.fetchConstants()
|
|
|
|
}
|
2022-04-22 05:05:56 +02:00
|
|
|
},
|
|
|
|
immediate: true
|
|
|
|
},
|
|
|
|
isEnabledGovernance(isEnabled) {
|
|
|
|
if (!isEnabled) {
|
2022-05-27 11:28:20 +02:00
|
|
|
this.$nuxt.error({ statusCode: 204, pageName: 'governance' })
|
2022-04-22 05:05:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions('governance/gov', ['fetchProposals', 'fetchConstants'])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|