mosh-hamedani / organic-shop

192 stars 204 forks source link

Cannot get cart from firebase #13

Open DavidHJR97 opened 4 years ago

DavidHJR97 commented 4 years ago

Anyone having trouble getting the shopping cart from firebase. I noticed on my project that my "add to cart" button is not showing up because It cannot get the shopping cart from firebase. I think I am having the problem in the function below:

  async getCart(): Promise<Observable<ShoppingCart>> {
    const cartId = await this.getOrCreateCartId();
    console.log(cartId);
    return this.db.object('/shopping-carts/' + cartId).valueChanges()
    .pipe(map(({items}) => new ShoppingCart(items)));
  }

image

Can anyone help me with this problem? Thanks!