document usage of exposed `reset` function
scalemaildev opened this issue Β· comments
π Your use case
Currently my account creation flow has the turnstile token validated, then some account creation stuff runs. If the account fails to create, the user is notified of why, and asked to fix the creation form.
However, the turnstile token is now invalid. So the user has to either refresh the page or wait for the token to regenerate.
π The solution you'd like
Is there any way to manually force a token refresh, so that I can refresh it whenever my submission form gets kicked back?
π Alternatives you've considered
No response
βΉοΈ Additional info
No response
Yes, there is - implemented via 0808524 - you should see an example usage in the playground.
A PR to the docs to add some info would be welcomed π
Of course I could contribute to your docs.
However, the function only appears to be exposed to a button click for some reason.
I.E I can refresh the token with a button that has "turnstile.reset()" as its clickable event, but I when calling it programmatically I get "turnstile.reset is not a function."
it would be turnstile.value.reset
Ok I opened a pr with some updated docs.
Thank you!
This reset function is still not very clear to me. The generation of a new token is not synchronous, and it is also not a Promise, how can I wait for the generation of this token to send it to the API when submitting the forms?