Как достать из callback функции переменную?

В некоторую переменную url мне приходят ссылки на фотографии из базы дынных firebase b при выводе в консоль я их вижу. Так вот, как мне достать оттуда эти ссылки, чтобы я их мог передать в src тега img

const ResultDisplay = () => {
 
  const storage = getStorage();
  const listRef = ref(storage, 'gs://wal1-papers.appspot.com/files');

   listAll(listRef)
  .then((res) => {
    res.items.forEach((itemRef) => {
      const allRef = ref(storage, itemRef)
      getDownloadURL(allRef)
       .then((url) => {


  })
  .catch((error) => {
    switch (error.code) {
      case 'storage/object-not-found':
        break;
      case 'storage/unauthorized':
        break;
      case 'storage/canceled':
        break;

      case 'storage/unknown':
        break;
    }
  });

    });
  }).catch((error) => {
    console.log(error)
  });


  return (
    <div>
      <img style={{width: '100%'}} src={''}/>
      <hr/> 
      <Icon20LikeOutline/> <span>0</span>
     <Icon28DownloadOutline width={20} height={20} style={{marginLeft: '230px', marginTop: '-39px'}}/>
    </div>
  )
}

export default ResultDisplay

Ответы (0 шт):