created auth system

This commit is contained in:
sdarbinyan
2026-02-28 17:18:24 +04:00
parent 86d11364f0
commit 6689acbe57
28 changed files with 1254 additions and 674 deletions

View File

@@ -2,7 +2,7 @@ import { Component, computed, ChangeDetectionStrategy, signal, OnDestroy, inject
import { DecimalPipe } from '@angular/common';
import { Router, RouterLink } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { CartService, ApiService, LanguageService } from '../../services';
import { CartService, ApiService, LanguageService, AuthService } from '../../services';
import { Item, CartItem } from '../../models';
import { interval, Subscription } from 'rxjs';
import { switchMap, take } from 'rxjs/operators';
@@ -28,6 +28,7 @@ export class CartComponent implements OnDestroy {
isnovo = environment.theme === 'novo';
private i18n = inject(TranslateService);
private authService = inject(AuthService);
// Swipe state
swipedItemId = signal<number | null>(null);
@@ -134,6 +135,11 @@ export class CartComponent implements OnDestroy {
alert(this.i18n.t('cart.acceptTerms'));
return;
}
// Auth gate: require Telegram login before payment
if (!this.authService.isAuthenticated()) {
this.authService.requestLogin();
return;
}
this.openPaymentPopup();
}