Try out
function getFollowing() {
let follower = wixUsers.currentUser.id;
let followed = $w('#dynamicDataset').getCurrentItem();
wixData.query('following')
.eq('followed', followed)
.find()
.then(result => {
if (result.items.length > 0 && result.items[0].follower === follower) {
$w("#follow").label = "unfollow";
} else {
$w("#follow").label = "follow";
}
})
.catch(error => {
console.log(error);
});
}