diff --git a/.changeset/thin-oranges-collect.md b/.changeset/thin-oranges-collect.md new file mode 100644 index 0000000..4377f30 --- /dev/null +++ b/.changeset/thin-oranges-collect.md @@ -0,0 +1,5 @@ +--- +"@lookit/lookit-initjspsych": patch +--- + +Fix the exit URL interupting final Response patch diff --git a/packages/lookit-initjspsych/src/utils.ts b/packages/lookit-initjspsych/src/utils.ts index f7cc210..3b172b2 100644 --- a/packages/lookit-initjspsych/src/utils.ts +++ b/packages/lookit-initjspsych/src/utils.ts @@ -74,13 +74,12 @@ export const on_finish = ( userFunc(data); } - await Api.finish(); await Api.updateResponse(responseUuid, { exp_data, sequence: [...sequence, `${last_exp.trial_index}-${last_exp.trial_type}`], completed: true, - }); - - exit_url && window.location.replace(exit_url); + }) + .then(() => Api.finish()) + .then(() => exit_url && window.location.replace(exit_url)); }; };