Newb here. I’ve been following the Wix series about setting up a social media platform for a small group.
When the current_user is writing a comment, I want that comment to show his profilePic and fullName; however, creating the comment requires the “write-only” database named comments . The profilePic (already displayed on the page, as userImage ) and fullName (not displayed already on the page) are in the database named users . The idea is that when the commentButton is clicked, the post will include the picture and name, now copied into the comments database . I’ve been searching the forums and have found some similar ways to code this, but I’m at a loss. I’ve added below what I’ve frankensteined together so far.
export function commentButton_click(event) {
let picture = $w(“#userImage”);
let user = wixUsers.currentUser;
wixData.quer [y("user](user.id;) [u]s[/u] ")
.find(wixUsers.currentUser)
.then((results) => {
**let** toUpdate = {
"name": fullName,
"picture": commentPic
};
wixData.update("comments", toUpdate)
.then((results) => {})
. **catch** ((err) => {
**let** errorMsg = err;
});
})
}
I’m missing how certain operators are supposed to work. I’ve been on the Corvid reference, but I’m still not finding what I need. Any help is appreciated.