How do I access the url that returns me in the.log console?

Asked

Viewed 86 times

0

I am doing a photo upload to firebase Storage, everything goes well, the file is transferred and recorded inside. But when I sign up within the task I can’t get the image download url to record to a variable and send to the bank later.

What’s returning to me is this at the moment:

inserir a descrição da imagem aqui

My job is this::

  uploadFoto(){
    if(this.blobFotoPerfil){
    const ref = 
   this.afs.ref(`profissionais/${this.nomeUsuarioPastaStorage}/perfil.jpg`);
    const task = ref.put(this.blobFotoPerfil);

    this.percentualProgresso = task.percentageChanges();

    task.snapshotChanges().subscribe( data => {
    console.log(data.downloadURL);
    console.log(data.ref.getDownloadURL());
    console.log(data.ref.fullPath);
  })

 }

The getDownloadURL() method returns me that C there on the console, and inside it has the photo url, however I do not know how to access it.

  • Try C.i or C['i'] or data.ref.getDownloadURL()['i']... etc.

  • 1

    Resolved as follows: uploadFoto(){ if(this.blobFotoPerfil){ const ref = this.afs.ref(profissionais/${this.nomeUsuarioPastaStorage}/perfil.jpg); const task = ref.put(this.blobFotoPerfil); this.percentualProgression = task.percentageChanges(); task.snapshothangeChanges(). subscribe( data => { data.ref.getDownloadURL().then( data => { this.professional.urlFotoPerfil = data; console.log(this.professional.urlFotoPerfil); }) }) &#Xa a; }

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.