Hey, I'm trying to make sure the survey completes only after i get a response from an external API service we have.
I'm using the onCompleting event and try to set the allow field to false/true based on the result but I guess i'm doing something wrong because the options.allow = false
does prevent from the complete page to show up but when I change it back to true it doesn't go to the complete page.
This is my code:
TypeScriptsurvey.onCompleting.add((_, options) => {
options.allow = false;
if (questionnaireId) {
completeQuestionnaireToast(
completeQuestionnaire(gatherProcessId, questionnaireId)
).then(() => (options.allow = true));
}
});