Hello,
try to work with this one… to solve the first part of your issue…
import wixUsers from'wix-users';
function get_UserData() {
let user = wixUsers.currentUser;
let userId = user.id; // "r5cme-6fem-485j-djre-4844c49"
let isLoggedIn = user.loggedIn; // true
console.log(user)
console.log(userId)
console.log("isLoggedIn = " + isLoggedIn )
user.getEmail()
.then( (email) => {
let userEmail = email; // "user@something.com"
console.log(userEmail)
} );
user.getRoles()
.then( (roles) => {
let firstRole = roles[0];
let roleName = firstRole.name; // "Role Name"
let roleDescription = firstRole.description; // "Role Description"
console.log (roles)
console.log (firstRole)
console.log (roleName)
console.log (roleDescription)
} );
}
Take a look into your CONSOLE and at the RESULTS.
It could be that you have to modify the CODE a little bit, i did not test it.