Я получаю следующую ошибку:
ОШИБКА TypeError: Невозможно прочитать свойство 'pipe' из undefined в DashboardComponent.push ../ src / app / dashboard / dashboard.component.ts.DashboardComponent.getReferredUsers
Мой код выглядит следующим образом:
ngOnInit() {
this.ngxLoader.start();
this.isMobile = this.breakpointObserver.observe([Breakpoints.Handset]);
this.campaignMode = environment.campaignMode;
this.anonymousPhotoURL = 'https://i.imgflip.com/1slnr0.jpg';
this.user = JSON.parse(localStorage.getItem('user'));
this.userService.getUserById(this.user.uid).subscribe(result => {
if (result) {
this.setUser(result);
this.createReferralUrls();
this.calculateNoOfUsers();
this.calculateRanking();
this.getReferredUsers();
this.ngxLoader.stop();
}
});
}
Ошибка происходит здесь:
getReferredUsers() {
this.invitees$ = this.userService.getReferredUsers(this.userData.referralId).pipe(map(result => {
return result;
}));
}
Метод в ReferralService выглядит следующим образом:
getReferredUsers(referralId) {
if (referralId) {
return this.afs.collection('users', ref => ref.where('referredBy', '==', referralId).limit(3)).valueChanges();
}
}
Как я могу это исправить?