Skip to content

Commit

Permalink
Exit URL fix (#109)
Browse files Browse the repository at this point in the history
* modify on_finish logic to throw error if both sequence and data are empty

* update surveys version in package lock

* add changeset

* Small change to tests and sequence error logic

* Fix exit url interrupting Response patch

* Changeset

---------

Co-authored-by: Becky Gilbert <[email protected]>
  • Loading branch information
okaycj and becky-gilbert authored Nov 6, 2024
1 parent 7e4c63e commit 0d02095
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/thin-oranges-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lookit/lookit-initjspsych": patch
---

Fix the exit URL interupting final Response patch
7 changes: 3 additions & 4 deletions packages/lookit-initjspsych/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
};
};

0 comments on commit 0d02095

Please sign in to comment.