Hi Shlomi, this is what I have so far:
import wixUsers from “wix-users”;
import wixData from “wix-data”;
// the onClick handler for the button in the repeated item
export function button29_click(event, $w) {
// let's get the userId of the current logged in user
const followerId = wixUsers.currentUser.id;
console.log("followerId: ", followerId);
// let's get the userId from the repeated item
// where the button was clicked
// (replace "#myMembersDataset" with the name of your dataset
const followeeId = $w("#dataset2").getCurrentItem()._owner;
console.log("followeeId: ", followeeId);
// save them to our "Followings" collection
// using the wixData API
wixData.insert("Followings", {
"followee": followeeId,
"follower": followerId
}) .catch((err) => {
// to help you debug if something went wrong
console.log(err);
});
}
I don’t know what to do from here. I have created a database with two columns: “followers” and “followees”. The database is called “Followers_Followees”. When I preview my site and check how things are going, the data isn’t submitted into the “followers_followees” database. Do I need to connect my database somehow? If so, how? Does the code look good? Anything I should fix?