I have a collection of images (selfies) that I would like to display on a page. Here is my code but it is not working. (I cannot simply just link the page to the collection because the page is already dynamically linked with another collection)
wixData.query("Selfie")
.eq("playerName", ($w("#playerName").text).toString())
.find()
.then((results) => {
let item = (results.items[0]);
if (item.selfie === undefined) {
} else {
$w("#selfieImage").src = (item.selfie);
}
});
}
I would like the image on the page to be set to its default image if the player has not already added their picture, but if they have I want the picture to be retrieved from the collection Selfie (playerName is unique).
Thanks in advance!