fix: governance 404 page

This commit is contained in:
Danil Kovtonyuk 2022-05-27 19:28:20 +10:00
parent acf0f2e818
commit d7eed4262e
8 changed files with 114 additions and 47 deletions

View file

@ -12,7 +12,7 @@ import Metrics from '@/components/governance/Metrics'
export default {
middleware({ store, error }) {
if (!store.getters['governance/gov/isEnabledGovernance']) {
return error({ statusCode: 404 })
return error({ statusCode: 204, pageName: 'governance' })
}
},
components: {
@ -25,14 +25,16 @@ export default {
watch: {
isInitialized: {
handler() {
this.fetchProposals({})
this.fetchConstants()
if (this.isEnabledGovernance) {
this.fetchProposals({})
this.fetchConstants()
}
},
immediate: true
},
isEnabledGovernance(isEnabled) {
if (!isEnabled) {
this.$router.push('/')
this.$nuxt.error({ statusCode: 204, pageName: 'governance' })
}
}
},