Reference Page: https://jds-cvoa.wixsite.com/cvoa/CVOA-Registry
I have a document URL stored in a database. Another database stores an owner email. The document should only be accessible if the current logged in user matches the owner email.
The code for this page does numerous things… search, three different lightbox collections, but when I implement this button click the page hangs…
Here is the code snipit that hangs the page:
export function historyButton_click(event, $w) {
// get logged in user
let user = wixUsers.currentUser;
let userId = user.id; // “r5cme-6fem-485j-djre-4844c49”
let isLoggedIn = user.loggedIn; // true
let userRole = user.role; // “Member”
user.getEmail()
.then( (email) => {
let userEmail = email; // “user@something.com”
}
let ownerEmail = ($w(‘dynamicDataset’).getCurrentItem(email))
let historyDoc = ($w(‘CV-Registry-History’).getCurrentItem(History-Doc)) // is type URL
console.log(ownerEmail)
console.log(userEmail)
console.log(historyDoc)
if (userEmail === ownerEmail) {
wixLocation.to(historyDoc);
else
wixWindow.openLightbox(‘Registory History Request’, $w(‘#dynamicDataset’).getCurrentItem());
}
});