@aeroengineerz7
Working on a comment-box? ![]()
Step-1: Getting the right logged in user… (you do not need the back-end in your case, because you are working with your own databse and not with PMD)
import wixUsers from 'wix-users';
let user = wixUsers.currentUser;
let userId = user.id;
let isLoggedIn = user.loggedIn;
user.getEmail()
.then( (email) => {
let userEmail = email;
} );
Step-2: After you have the current-users-ID you have to find this ID in your own database —> “MemberPage” (filtering-process).
wixData.query("MemberPage")
.eq('_id', userId)
6 .find()
7 .then( (results) => {
8 if(results.items.length > 0) {
9 let firstItem = results.items[0];
let items = results.items
console.log(items)
10 } else {
11 // handle case where no matching items found
12 }
13 } )
14 .catch( (err) => {
15 let errorMsg = err;
16 } );
Console should show the founded result(s).