Skip to content
Snippets Groups Projects
Commit e79845c9 authored by Jonathan Foucher's avatar Jonathan Foucher
Browse files

Automatically redirect to evaluation current step.

parent 60cfbee4
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,7 @@ export default {
computed: {
level: {
get() {
return this.evaluation.danger_levels ? this.evaluation.danger_levels.find(d => d.danger_id === this.danger.id).id : null
return this.evaluation.danger_levels && this.evaluation.danger_levels.find(d => d.danger_id === this.danger.id) ? this.evaluation.danger_levels.find(d => d.danger_id === this.danger.id).id : null
},
set(level) {
......
......@@ -51,7 +51,9 @@ export default {
evaluation() {
const evaluation = this.$store.state.evaluations.all.find(e => e.id === parseInt(this.$route.params.id, 10))
console.log('levels from parent',evaluation ? evaluation.danger_levels : 'no levels')
if (evaluation) evaluation.current_step = 1;
if (evaluation && evaluation.current_step && evaluation.current_step !== 1) {
this.$router.push(`/evaluations/${evaluation.id}/${evaluation.current_step}`)
}
return evaluation || defaultEvaluation
}
},
......
......@@ -132,6 +132,7 @@ export default [
},
{ path: ':id', component: SingleEvaluation, children: [
{ path: '', component: EvaluationStep1 },
{ path: '1', component: EvaluationStep1 },
{ path: '2', component: EvaluationStep2 },
{ path: '3', component: EvaluationStep3 },
{ path: '4', component: EvaluationStep4 },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment