Ionic + Firebase: Error: Uncaught (in promise): [object Object]

0

I'm new to ionic and I'm facing a problem, I have this application that works with camera / gallery, and I believe the error is in the .ts file and here's the code:

save(animal) {
      this.dbService.save(animal).then(
        response => {
          // ALERT DE QUE FOI SALVO COM SUCESSO
          let storageRef = firebase.storage().ref();
          let imageRef = storageRef.child('image').child(response.key);

          imageRef.putString(this.animal.fotoAtual, 'data_url')
            .then(snapshot => {
              console.log(snapshot)
            }, err => {

          })
          this.toastrService.show('Registro realizado com sucesso!', 3000).present();
            this.navCtrl.setRoot(ListPage);
        },
        error => {
          // ALERT DE QUE DEU ERRO NA FUNÇÃO
        }
      ), (r => console.log(r));
      }

In the case in my application I have a provider that centralizes the application crud, then I have the save method that looks like this:

save(animal: any){
   return this.dbRef
        .push(animal);
  }

Thank you in advance

    
asked by anonymous 18.11.2018 / 01:43

0 answers