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

get captcha token in TS file #1486

Open
alireza0sfr opened this issue Jan 9, 2024 · 1 comment
Open

get captcha token in TS file #1486

alireza0sfr opened this issue Jan 9, 2024 · 1 comment

Comments

@alireza0sfr
Copy link

alireza0sfr commented Jan 9, 2024

Describe the feature

Hello Thanks for the amazing effort that you have put in this package,

I have a custom api plugin and I want to send recaptcha tokens on any POST request automatically this is a sample code to demonstrate:

import { useChallengeV3 } from 'vue-recaptcha'

if(payload && ['POST', 'PUT', 'PATCH'].includes(options.method)) {
        const { execute } = useChallengeV3(actionType)
        payload.RT = await execute()

but I can't use useChallengeV3 outside of a setup function or .vue file because it's a composable, Is there any workarounds ?

@DanSnow
Copy link
Owner

DanSnow commented Jan 22, 2024

Maybe try to wrap useChallengeV3 with runWithContext https://vuejs.org/api/application.html#app-runwithcontext

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

No branches or pull requests

2 participants