Route marketplace data through product facade

This commit is contained in:
sdarbinyan
2026-07-05 01:03:37 +04:00
parent 05d75421f5
commit ae3512ad37
6 changed files with 31 additions and 23 deletions

View File

@@ -2,7 +2,7 @@ import { Component, signal, HostListener, OnDestroy, ChangeDetectionStrategy, in
import { DecimalPipe } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterLink } from '@angular/router';
import { ApiService, CartService } from '../../services';
import { CartService } from '../../services';
import { PrefetchService } from '../../services/prefetch.service';
import { Item } from '../../models';
import { Subject, Subscription } from 'rxjs';
@@ -13,6 +13,7 @@ import { LangRoutePipe } from '../../pipes/lang-route.pipe';
import { TranslatePipe } from '../../i18n/translate.pipe';
import { TranslateService } from '../../i18n/translate.service';
import { SEARCH_DEBOUNCE_MS, ITEMS_PER_PAGE, SCROLL_THRESHOLD_PX, SCROLL_DEBOUNCE_MS } from '../../config/constants';
import { ProductFacade } from '../../facades/platform/product.facade';
@Component({
selector: 'app-search',
@@ -37,7 +38,7 @@ export class SearchComponent implements OnDestroy {
private i18n = inject(TranslateService);
constructor(
private apiService: ApiService,
private productFacade: ProductFacade,
private cartService: CartService,
private prefetchService: PrefetchService
) {
@@ -85,7 +86,7 @@ export class SearchComponent implements OnDestroy {
this.loading.set(true);
this.isLoadingMore = true;
this.apiService.searchItems(this.searchQuery, this.count, this.skip).subscribe({
this.productFacade.searchProducts({ search: this.searchQuery, count: this.count, skip: this.skip }).subscribe({
next: (response) => {
// Update total results (only on first load)
if (this.skip === 0) {