Help Pleas

There was an error in your code when I tried it, but I fixed it when entering the reference data and it worked, but after the data was entered and the validation was updated to make sure the validation was logged it still didn’t run after I reloaded the page.

This is the code I use.
$w.onReady(function () {
    $w('#follow').onClick(function () {
        follow();
    });
});

function follow() {
    let follower = wixUsers.currentUser.id
    let followed = $w('#dynamicDataset').getCurrentItem();
    wixData.insert('following', {
            'followed': followed,
            'follower': follower
        })
        .then(updateValidity)
        .catch((err) => {
            console.log("err");
        });
}

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);
        });
}

function updateValidity() {
    $w("#follow").label = "Unfollow";
}