feat: introduce loading context management across services

- Refactor AuthService, CartService, CatalogService, CheckoutService, TenantService, and TicketService to extend BaseApiService for consistent loading context handling.
- Implement loading modes ('global', 'custom', 'none') using HttpContext for API requests.
- Update existing service methods to accept loading mode parameters and propagate them to HTTP requests.
- Enhance global loading interceptor to respect loading modes and prevent global loading for specific requests.
- Add unit tests to verify loading mode propagation in services and interceptors.
- Update component interactions to utilize the new loading mode functionality.
This commit is contained in:
2026-07-29 11:54:31 -03:00
parent 125d9137fb
commit da61067c6a
28 changed files with 355 additions and 105 deletions

View File

@@ -66,6 +66,9 @@ describe('PurchaseStatusPageComponent', () => {
async function render(hasGeneratedTickets: boolean) {
const checkoutService = {
getPurchase: vi.fn().mockResolvedValue(purchase(hasGeneratedTickets)),
withCustomLoading() {
return this;
},
};
const router = {
navigate: vi.fn().mockResolvedValue(true),

View File

@@ -63,7 +63,9 @@ export class PurchaseStatusPageComponent implements OnInit {
}
try {
const purchase = await this.checkoutService.getPurchase(this.tenantCode, this.purchaseId);
const purchase = await this.checkoutService
.withCustomLoading()
.getPurchase(this.tenantCode, this.purchaseId);
this.status.set(this.resolveStatus(purchase));
this.hasGeneratedTickets.set(purchase.has_generated_tickets === true);
} catch (error) {