Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute should return a promise or you should expose a refresh method #25

Open
fabn opened this issue Jun 19, 2020 · 1 comment
Open

Comments

@fabn
Copy link

fabn commented Jun 19, 2020

I'm having a problem with this scenario:

  • Load recaptcha
  • Load token <ReCaptcha ref={ref => recaptcha = ref} sitekey={siteKey} action='checkout' verifyCallback={filled}/>
  • Submit form with token, captcha validation is ok but some business data are wrong => form shows errors
  • User correct data and resubmit => captcha is reused

I'm having some trouble to get a new token with current interface. I'd like to use something

this.recaptcha.execute()
  .then(token => /* set new token on request */)
  .then(() => api.post(/* new data and new token*/))

or simply a new method that refresh the token with a promise something like

this.recaptcha.refresh() // verify is called again when promise is fulfilled
  .then(() => api.post(/* new data */)) // using the refreshed token

What do you think?

@vincentkedison
Copy link

I've exact same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants