Я пытаюсь l oop просматривать файлы в папке с играми на firebase и отображать их на странице в виде списка.
// Create a reference under which you want to list
var listRef = firebase.storage().ref("games/");;
// Find all the prefixes and items.
listRef.listAll().then(function(res) {
res.prefixes.forEach(function(folderRef) {
// All the prefixes under listRef.
// You may call listAll() recursively on them.
});
res.items.forEach(function(itemRef) {
// All the items under listRef.
console.log(itemRef)
const p = document.createElement('a');
p.textContent = itemRef.location.path;
p.classList.add('col-lg-12');
p.href = itemRef.getDownloadURL();
console.log(p.href);
document.getElementById('bar').appendChild(p);
document.getElementById('bar').innerHTML+='<br />'
});
}).catch(function(error) {
// Uh-oh, an error occurred!
});
Проблема в том, что я получаю p. href = [object% 20promise] вместо URL-адреса загрузки моего файла.