I am new on VueJS. I created a component with a validateBotLogin() method which contains grecaptcha.execute code. I was able to get the Token. However, I don’t know how to call another method after getting the Token. Below is the error that I have encountered.
TypeError: Cannot read properties of undefined (reading ‘login’)
Code:
validateBotLogin() {
grecaptcha.ready(async function() {
await grecaptcha.execute('{key}', {action: 'submit'}).then(function(token) {
console.log(token);
if (token.length > 0) {
this.login();
}
});
});
},
login() {
});
My question is “How do I call the login method after validateBotLogin()? Kindly advise. Thank you.