0

I am currently trying to call my Firebase Firestore - which works as expected when using the following code:

this.store.collection('posts').valueChanges().subscribe((data) => {
  console.log(data);
});

Which is good and all but I'd much rather use async/await to get the data. I tried the following:

const test = await this.store.collection('posts').valueChanges().toPromise();

But test is never populated when I place a debugger or console log of test. Am I missing something stupid or can you not transform an Observable to a promise and await it as above?

Kamil Naja
  • 6,267
  • 6
  • 33
  • 47
Tachyon
  • 2,171
  • 3
  • 22
  • 46

0 Answers0