[HIMA-67] - search filters included

This commit is contained in:
Peter Skrlj
2019-02-12 09:31:09 +01:00
parent f85ecae553
commit 60cf116815

View File

@@ -1,3 +1,4 @@
import { FilterState } from './../../core/store/state/filter.state';
import { ProductService } from './../../core/services/product.service';
import { Component, OnInit } from '@angular/core';
import { Search } from 'src/app/core/models/search.model';
@@ -53,10 +54,20 @@ export class SearchResultsComponent implements OnInit {
this.ds = new SearchDataSource(
this.productService,
this.currentSearch.query,
this.store
this.store,
[]
);
// this.store.dispatch(new GetProducts(this.currentSearch));
// this.loadProducts();
this.store.select(FilterState.getFilters).subscribe(fil => {
if (!!fil) {
this.ds = new SearchDataSource(
this.productService,
this.currentSearch.query,
this.store,
fil
);
}
});
}
loadCurrentSearch() {
@@ -104,7 +115,8 @@ export class SearchDataSource extends DataSource<Product | undefined> {
constructor(
private searchService: ProductService,
private search: string,
private store: Store
private store: Store,
private filters: any[]
) {
super();
}
@@ -148,7 +160,7 @@ export class SearchDataSource extends DataSource<Product | undefined> {
this.search,
page * this.pageSize,
this.pageSize,
[]
this.filters
)
.pipe(take(1))
.subscribe(data => {