Hi!
You can use a simple query to retrieve the data as long as it is saved in your collection .
These specific data items (userID, role, email) are available to the site owner only on the occasion of a logged-in user. The currentUser method could be use to retrieve them.
In case you do save them into a collection for every user that logs in, you can use the following code snippet:
import wixData from 'wix-data';
wixData.query("Customer")
.limit(15) //up to 1000. Default value is 50
.find()
.then( (results) => {
results.items.forEach( (item => {
let userID = item._id;
let userEmail = item.email;
let userRole = item.role;
})
});
Remember!
It will only work if you’ve got the mentioned data stored in your collection!
Doron.