Hello all,
Quick question for you all regarding database queries. I’m sure this is a basic coding concept but is there a way to put this
function query() {
let currentUser = wixUsers.currentUser;
currentUser.getEmail().then(email => {
wixData.query('Members').eq('email', email).find()
.then((results) => {
let item = results.items[0];
});
});
}
Is there a way to save this process and use the “item” variable from this query in another function and then use it within other functions like for example
updateFields(query);
With query replacing the requirement to have to write the query as above and essentially transferring the “item” variable from the query?
Thanks much.
Kind regards,
Chris