-
Notifications
You must be signed in to change notification settings - Fork 132
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
Handle All Error From ReCaptchaV3Service #147
Comments
@yanchespenda Hi, how did you solve this problem? |
@Smip I'm used timeout for cheking a error from the captcha Like this, recaptchaTimeout() {
setTimeout(() => {
if (this.isLoading && !this.isHttpLoading) {
this.isLoading = false;
this.errorMSG = 'Recaptcha Error, make sure your internet connection stable';
this.isErrorPrimary = true;
}
}, 5500);
} For submit form SubmitA() {
this.isErrorPrimary = false;
this.isLoading = true;
this.recaptchaTimeout();
this.recaptchaUnsubscribe();
this.recaptchaSubscriber = this.recaptchaV3Service.execute('login_a1')
.subscribe((token) => {
if (token === null) {
// Response is null due to what? Expiration? reset?
this.recaptchaUnsubscribe();
return;
}
this.isHttpLoading = true;
// Http services form
....
// If http success
this.isLoading= false;
});
} |
@yanchespenda Thank you! |
More concise solution is: SubmitA() {
this.recaptchaV3Service.execute('login_a1')
.pipe(
timeoutWith(5000, throwError(new Error('timeout'))),
)
.subscribe(
(token) => {
// handle captcha token
},
(error) => {
if (error.message === 'timeout') {
// handle timeout
}
},
);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
I'm submitting a:
Description
When internet connection slow or something it will show
Uncaught (in promise): [object Null]
in console,I was trying from using pipe errorCache before subscribe() still does not work
Sometimes i get error same with #123 (comment)
A_LINK_WITH_YOUR_EXAMPLE
I'm used the code like this
https://stackblitz.com/edit/angular-t6kdki
Lib versions:
tsc --version
): 3.5.3Thank you for help!
The text was updated successfully, but these errors were encountered: