import wixData from 'wix-data';
import wixLocation from 'wix-location';
$w.onReady(function () {
$w("#listRepeater").onItemReady( ($item, itemData, index) => {
let count = itemData;
if (count < 1) {
$w('#listRepeater').collapse();
$w('#text89').collapse();
$w('#box3').collapse();
$w("#image1").collapse();
$w('#text90').show();
}
if(itemData.title){
$item("#text216").text = itemData.title;
}else if(itemData.name){
$item("#text216").text = itemData.name;
}
if(itemData.name){
let linkToDynamicPage = itemData["llink-adoptable-dogs-1-title"];
$w('#button64').onClick(() => {
wixLocation.to(linkToDynamicPage);
});
}else if(itemData.title){
let linkToDynamicPage = itemData["link-adoptable-cats-title"];
$w('#button64').onClick(() => {
wixLocation.to(linkToDynamicPage);
});
}
$item("#image47").src = itemData.picture;
} );
wixData.query("AdoptableCats")
.eq('foster',true)
.find()
.then( (results) => {
let cats = results.items;
wixData.query("AdoptableDogs")
.eq('foster',true)
.find()
.then( (results) => {
let dogs = results.items
let all = cats.concat(dogs)
console.log(all)
$w('#listRepeater').data = all;
// $w('#box3').onViewportEnter( (event) => {
// let items = $w("#repeater6").data.length.toString();
// $w('#image1').show();
// if (+items >= count) {
// $w('#image1').hide();
// $w('#text214').show();
// }else if (+items < count){
// $w("#dynamicDataset").loadMore()
// .then( () => {
// $w('#image46').hide();
// });
// }
// });
})
})
.catch( (err) => {
let errorMsg = err;
console.log(errorMsg)
} );
});
the commented out code was how it was when using a dataset but I’m not using one for this page