polling
This commit is contained in:
@@ -5,7 +5,7 @@ import { FormsModule } from '@angular/forms';
|
||||
import { CartService, ApiService, LanguageService, AuthService } from '../../services';
|
||||
import { Item, CartItem } from '../../models';
|
||||
import { interval, of, Subscription } from 'rxjs';
|
||||
import { catchError, switchMap, take } from 'rxjs/operators';
|
||||
import { catchError, exhaustMap, switchMap, take, timeout } from 'rxjs/operators';
|
||||
import { EmptyCartIconComponent } from '../../components/empty-cart-icon/empty-cart-icon.component';
|
||||
import { TelegramLoginComponent } from '../../components/telegram-login/telegram-login.component';
|
||||
import { environment } from '../../../environments/environment';
|
||||
@@ -280,8 +280,9 @@ export class CartComponent implements OnDestroy {
|
||||
this.pollingSubscription = interval(PAYMENT_POLL_INTERVAL_MS)
|
||||
.pipe(
|
||||
take(this.maxChecks), // maximum 36 checks (3 minutes)
|
||||
switchMap(() => {
|
||||
exhaustMap(() => {
|
||||
return this.apiService.checkPaymentStatus(this.paymentId()).pipe(
|
||||
timeout(8000),
|
||||
catchError((err) => {
|
||||
console.error('Error checking payment status:', err);
|
||||
return of(null);
|
||||
|
||||
Reference in New Issue
Block a user