Brett,
It would look like this:
PS. Make sure to change .eq(’ emailField ', userEmail) → the emailField value here to your actual database field value.
import wixUsers from 'wix-users';
let user = wixUsers.currentUser;
user.getEmail()
.then( (email) => {
let userEmail = email; // "user@something.com"
wixData.query('YourCollectionName')
.eq('emailField', userEmail)
.find()
.then((res) => {
if(res) {
console.log('Duplicate user found, returning');
//below is error messages to show
$w('#error').show();
$w('#errorText').show();
}
//insert to collection here (no duplicate found)
})
} );
Hope this helps,
Majd