Hi guys!
I have a page where (signed in) users can submit some data for an order. When the data is submitted, I send an automatic email with the data which is submitted. To this data I want to add PrivateMembersdata such as name, email, address, … . So get the private membersdata, I am using
the following backend code :
//.jsw file
import wixUsersBackend from 'wix-users-backend';
export function getUser(id) {
return wixUsersBackend.getUser(id);
}
The page code is :
import wixUsers from 'wix-users';
import wixData from 'wix-data';
import {getUser} from 'backend/getttinguserdata';
$w.onReady(function () {
$w("#Bestellingendataset").onAfterSave( () => {
if(wixUsers.currentUser.loggedIn) {
const userId = wixUsers.currentUser.id;
console.log(getUser(userId));
wixUsers.emailUser("Bevestigings_email_met_data", userId, {
"variables": {
//Achternaam: lastName,
//Voornaam: wixUsersBackend.UserInfo(firstName),
//"Email": [userEmail],
//adres: wixUsersBackend.Address,
//Telefoon: ,
"Voorkeurleveringophaling": $w("#inputlevering").value,
"Voorkeur": $w("#inputvoorkeur").value,
"Opmerkingen": $w("#inputopmerkingen").value,
"Datum": $w("#inputdatum").value,
"debestelling":$w("#inputbestelling").value
}
} )
.then( () => {
console.log("Succes");
} )
.catch( (err) => {
console.log(err);
} );
}
} );
} );
I am getting the following result as output
Why is it returning an empty object? Is there any way to fix this? Is there another way how to get the privatemembers data?
Thanks in advance!
Kind regards