我想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'])
);
}
}