I’m trying to make a “follow” function on my site for users to follow each other by clicking a “follow” button on a repeating layout. I also want to add a text element that displays the amount of users that are following the user. This is my code so far, but I know that it is wrong:
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
$w.onReady(function () {
//TODO: write your page related code here…
});
import wixUsers from “wix-users”;
import wixData from “wix-data”;
export function button20_click() {
const followerId = wixUsers.currentUser.id;
console.log(“followerId: “, followerId);
const followeeId = $w(”#dataset1”).getCurrentItem()._owner;
console.log("followeeId: ", followeeId);
wixData.insert(“Followers_Followees”, {
“followee”: followeeId,
“follower”: followerId
}) .catch((err) => {
console.log(err);
});
}
Thanks in advance to anyone who helps out! I’m VERY bad with Wix Code, so detailed instructions would be nice
Here is a link to the page on my site where I want the follow buttons:
https://www.pawtalog.com/profiles