0

I'm working with Angular 14/ Firebase (Firestore) database, and I created a getAll() methode but I got Undefined result

this is my getAll() methode in my service :

getAllCampaigns() {
    const db = collection(this.firestoreDB, 'mail_campaign');
    return from(
      getDocs(db).then((response) => {
        response.docs.map((item) => {
          return { ...item, id: item.id };
        });
      })
    );
  }

here I'm calling the my methode (in the component)

getAllCampaigns() {
    this.campaignService.getAllCampaigns().subscribe((res) => {
      console.log(res);
    });
  }

the result of console.log(res); is undefined

any help please ?

Wahéb
  • 541
  • 1
  • 5
  • 15

0 Answers0