0

我想additionalCollectionState在请求时更改 NgRx 数据属性计数getWithQuery。不幸的是没有变化。

实体元数据

开发工具

@Injectable()
export class CourseLevelDataService extends DefaultDataService<any> {
  constructor(
    http: HttpClient,
    httpUrlGenerator: HttpUrlGenerator,
    private store: Store<EntityCache>,
    private dispatcher: Store<EntityCacheDispatcher>
  ) {
    super('CourseLevel', http, httpUrlGenerator);
    const token = localStorage.getItem('auth');
  }
  
  getWithQuery(params: QueryParams): Observable<any> {
    var count;
    return this.http
      .get<any>(environment.apiUrl + `CourseLevel`, { params })
      .pipe(
        tap((res) => {
          count = res.count;
          //I Want to change here count
          this.store.dispatch(addCount({ count: count }));
          console.log(count);
        }),
        map((res) => res['data'])
      );
  }
}
4

0 回答 0