fix: fix acces for logged out visitors

This commit is contained in:
2025-05-19 04:54:06 +02:00
parent ace54fb4ef
commit 07702b93b1
6 changed files with 62 additions and 46 deletions

View File

@@ -81,17 +81,21 @@ async function loadEvents(org_id: number, evs?: Promise<any>) {
document.addEventListener("DOMContentLoaded", async () => {
var user = await getMyAccount();
var org_id: number = -1;
if (user) {
if (user.isOrganisation) {
unhideElementById(document, "mainContainer");
unhideElementById(document, "addnewevent-btn");
org_id = user.organisationId;
try {
var user = await getMyAccount();
if (user) {
if (user.isOrganisation) {
unhideElementById(document, "mainContainer");
unhideElementById(document, "addnewevent-btn");
org_id = user.organisationId;
}
unhideElementById(document, "logout-btn");
}
unhideElementById(document, "logout-btn");
} else {
} catch {
// console.log("User not signed in. Failing gracefully.");
unhideElementById(document, "joinnow-btn");
unhideElementById(document, "signin-btn");
}
@@ -106,7 +110,7 @@ document.addEventListener("DOMContentLoaded", async () => {
const searchBar = document.getElementById('searchbar') as HTMLInputElement;
searchBar.addEventListener('keydown', (event) => {
if (event.key === 'Enter') {
console.log('Enter key pressed!');
// console.log('Enter key pressed!');
var searchResults = getEvents(searchBar.value);
loadEvents(org_id, searchResults);
}