Go back after completing a survey
This commit is contained in:
parent
3156b2c482
commit
533d3804d6
|
|
@ -115,7 +115,8 @@
|
|||
survey.data = flatAnswers;
|
||||
}
|
||||
|
||||
const saveSurvey = (sender, options) => {
|
||||
const saveSurvey = (sender, {exit}) => {
|
||||
this.$log.debug('saving survey', sender);
|
||||
if (this.saveDisabled) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -142,7 +143,6 @@
|
|||
data: JSON.stringify(data),
|
||||
};
|
||||
|
||||
this.$log.debug('saving survey', answer);
|
||||
this.$apollo.mutate({
|
||||
mutation: UPDATE_ANSWER,
|
||||
variables: {
|
||||
|
|
@ -159,10 +159,19 @@
|
|||
store.writeQuery({query, variables, data: queryData});
|
||||
}
|
||||
},
|
||||
}).then(() => {
|
||||
if (exit) {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
survey.onComplete.add(saveSurvey);
|
||||
survey.onComplete.add((sender, options) => {
|
||||
saveSurvey(sender, {
|
||||
...options,
|
||||
exit: true
|
||||
});
|
||||
});
|
||||
survey.onCurrentPageChanged.add(saveSurvey);
|
||||
|
||||
survey.css = css;
|
||||
|
|
|
|||
Loading…
Reference in New Issue