Skip to content

Commit

Permalink
async fix
Browse files Browse the repository at this point in the history
  • Loading branch information
birm committed Sep 13, 2023
1 parent 5aa9033 commit f69330a
Showing 1 changed file with 35 additions and 31 deletions.
66 changes: 35 additions & 31 deletions apps/landing/userInfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,39 +164,43 @@

<script src="../landing/util.js"></script>
<script type="text/javascript">
let screenName = getUserInfo().data.registration.firstName;
const screenNameElem = document.getElementById('screenName');
screenNameElem.innerText = `hi, ${screenName}`;
screenNameElem.style.display = '';

// populate userInfo
let userData = getUserInfo().data.registration
let userInfoDiv = document.getElementById('userInfo');
let userDataHtml = '<h2>User Data</h2>';
userDataHtml += '<b>Role:</b> ';
userDataHtml += getUserInfo().userType;
userDataHtml += '<br/>';
for (let field in userData){
userDataHtml += '<b>' + field + ':</b> '
userDataHtml += userData[field];
async function setupUserInfo(){
let screenName = getUserInfo().data.registration.firstName;
const screenNameElem = document.getElementById('screenName');
screenNameElem.innerText = `hi, ${screenName}`;
screenNameElem.style.display = '';

// populate userInfo
let userData = getUserInfo().data.registration
let userInfoDiv = document.getElementById('userInfo');
let userDataHtml = '<h2>User Data</h2>';
userDataHtml += '<b>Role:</b> ';
userDataHtml += getUserInfo().userType;
userDataHtml += '<br/>';
}
userDataHtml += '<br/><hr/><br/>'
userDataHtml += '<h2>Collections</h2>';
let allCollections = await store.getAllCollection();
let myCollections = getUserInfo().data.collections;
let myCollectionList = allCollections.filter(x=>{
if (myCollections.indexOf(x['_id']['$oid']) < 0){
return false;
} else {
return true;
for (let field in userData){
userDataHtml += '<b>' + field + ':</b> '
userDataHtml += userData[field];
userDataHtml += '<br/>';
}
}).map(x=>{
return '<li>' + x.name + '</li>';
})
userDataHtml += '<ul>';
userDataHtml += myCollectionList.join("")
userDataHtml += '</ul>';
userDataHtml += '<br/><hr/><br/>'
userDataHtml += '<h2>Collections</h2>';
let allCollections = await store.getAllCollection();
let myCollections = getUserInfo().data.collections;
let myCollectionList = allCollections.filter(x=>{
if (myCollections.indexOf(x['_id']['$oid']) < 0){
return false;
} else {
return true;
}
}).map(x=>{
return '<li>' + x.name + '</li>';
})
userDataHtml += '<ul>';
userDataHtml += myCollectionList.join("")
userDataHtml += '</ul>';
userInfoDiv.innerHTML = userDataHtml;
}
setupUserInfo()


</script>
Expand Down

0 comments on commit f69330a

Please sign in to comment.