in src/components/photos/Photos.js [71:109]
function addImagesToList(filename) {
let orig = 'photos/'.concat(filename);
let fullName = 'private/'.concat(cognitoID).concat('/photos/').concat(filename);
getPresignedURLS(orig, orig)
.then (result => {
let originalImageSigned = result[0];
let thumbImageSigned = result[1];
let currentImg = {
original: originalImageSigned,
thumbnail: thumbImageSigned,
description: 'Testing Description',
isSelected: false,
};
images.push(currentImg);
getPhotoLabels(fullName)
.then (result => {
let allLabels = result[0].data;
// console.log(allLabels)
if (allLabels) {
let labelsDetected = Object.values(allLabels);
const filterLabels = (cut, list) =>
list.filter(label => !label.includes(cut));
let filtered = filterLabels('private', labelsDetected).join(' * ');
for (let i in images) {
if (images[i].original.includes(filename)) {
images[i].description = filtered;
break; //Stop this loop, we found it!
}
}
}
});
});
}