Reroute if no voting data and users uses native go back

This commit is contained in:
Moritz Kröger 2017-08-26 21:58:55 +02:00
parent df91ece612
commit b924c832d0
2 changed files with 12 additions and 2 deletions

View file

@ -66,6 +66,12 @@
: '/theses/results'
})
}
},
created () {
if (!sessionStorage.getItem('euromat-answers')) {
this.$router.push({ path: this.isGermanLocale ? '/thesen' : '/theses' })
}
}
}
</script>

View file

@ -136,8 +136,12 @@
const emphasized = JSON.parse(sessionStorage.getItem('euromat-emphasized'))
const answers = JSON.parse(sessionStorage.getItem('euromat-answers'))
if (emphasized) this.emphasized = emphasized
if (answers) this.answers = answers
if (!emphasized) {
this.$router.push({ path: this.isGermanLocale ? '/thesen' : '/theses' })
}
this.emphasized = emphasized
this.answers = answers
this.scoringGrid = getScoringGrid(this.answers, this.emphasized)
this.scores = this.getScorePoints(this.scoringGrid)