I wonder how can send the default data already in getWithQuery()
, like this:
@Injectable({providedIn: 'root'})
export class CompaniesDataService extends DefaultDataService<Company> {
private readonly _URL: string = '/api/companies';
private readonly _DEFAULT_QUERIES: QueryParams = {top: '0', limit: '10', order: "name"};
constructor(http: HttpClient, httpUrlGenerator: HttpUrlGenerator) {
super('Company', http, httpUrlGenerator);
}
getWithQuery(queryParams: QueryParams | string = this._DEFAULT_QUERIES): Observable<Company[]> {
return this.http
.post<FmsHttpResponse<Company>>(`${this._URL}/search`, queryParams)
.pipe(map(response => response.content));
}
}
I mean this._DEFAULT_QUERIES
pass as default queryParams
in getWithQuery()
.
When I add function with resolver like this:
return this.companyEntityService.getWithQuery()
.pipe(tap(() => this.companyEntityService.setLoaded(true)));
I got error: Expected 1-2 arguments, but got 0.
.
Any idea? I would like to add that I am a novice ngrx programmer and maybe it is a simple question and I cannot find the answer.