'Is there a way to write this function without returning a undefined
I'm using angular fire to read data on firestore based on the logged in user. I check that the user object has been returned, and based on this I have a command to listen to document changes.
async getUsersCards() {
let _user: UserModel = await this.authService.GetUser();
if (_user) {
return this.angularFirestore
.collection<Card>('cards', (ref) =>
ref.where('owner', '==', _user?.uid)
)
.valueChanges();
} else {
}
}
Because I have a If check on the user, the signature of the function is Promise<Observable<board[]> | undefined> how do I remove the need for the undefined (what do I do in the else block ) ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
