Skip to content

Commit

Permalink
fix(login): setToken not setting before submitForm
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Aug 14, 2024
1 parent 38763df commit 37dad35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ export default () => {
sitekey={siteKey || '_invalid_key'}
onVerify={(response) => {
setToken(response);
submitForm();
// Ensure submitForm is called *after* token is updated
setTimeout(() => {
submitForm();
}, 0);
}}
onExpire={() => {
setSubmitting(false);
Expand Down
5 changes: 4 additions & 1 deletion resources/scripts/components/auth/LoginContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ function LoginContainer() {
sitekey={siteKey || '_invalid_key'}
onVerify={(response) => {
setToken(response);
submitForm();
// Ensure submitForm is called after token is updated
setTimeout(() => {
submitForm();
}, 0);
}}
onExpire={() => {
setSubmitting(false);
Expand Down

0 comments on commit 37dad35

Please sign in to comment.