(RESOLVED) How to get image url firestorage IONIC 5

How can get URL image in firestorage after save us

  upload(user: User) {
    return new Promise((resolve, reject) => {
      const fileRef = this.storage.ref('users/' + user.id + ".jpg");
      const uploadTask = fileRef.putString(user.avatar).then((snapshot) => {
        resolve(snapshot.downloadURL)
      }, err => {
        reject(err)
      }); 
    })        
  }

in this case, the get url its undefined ?

I don’t understand what you’re asking, but can’t see any benefit to making an extra Promise here. It introduces needless complexity and makes the code harder to read and follow.

I would like link url of image

snapshot.ref.getDownloadURL().then(url => console.log(url))

Sample code from a project:

        const path = `pictures/${this.userId}.jpg`;
        this.afStorage
          .ref(path)
          .putString(base64.split('base64,')[1], 'base64', {
            contentType: 'image/jpeg'
          })
          .then(snapshot => {
            let pictureUrl: any;
            snapshot.ref
              .getDownloadURL()
              .then(url => {
                pictureUrl = url;
                console.log('Uploaded to FireStorage: ', pictureUrl);
                // afStore
                this.afs
                  .collection('Users')
                  .doc<any>(this.userId)
                  .set({ photoURL: pictureUrl }, { merge: true })
                  .then(() => console.log('Saved to FireStore: ', pictureUrl))
                  .catch(err => console.log('FireStore Error: ', err));
                // afAuth
                this.auth.updatePhotoUrl(pictureUrl);
              })
              .catch(err => console.log('FireStorage Error: ', err));
          });

Solution to my case in this link : (RESOLVED) What's better format to save image in Firestore?