fix: front-end improvements

makes some fields visible and other hidden depending on the result of
some API calls, e.g. visitor is logged in -> show "Log out" button
This commit is contained in:
2025-05-19 00:43:15 +02:00
parent e0e6fa0573
commit 5536a9ad7f
15 changed files with 465 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
console.log("TypeScript działa!");
import { getEvent, getMyAccount, unhideElementById } from './generalUseHelpers.js';
async function createEvent() {
// Pobieranie danych z formularza
@@ -44,6 +44,18 @@ async function createEvent() {
document.addEventListener("DOMContentLoaded", () => {
const saveBtn = document.getElementById("saveBtn");
var user = await getMyAccount();
if (user) {
if (user.isOrganisation) {
unhideElementById(document, "mainContainer");
}
unhideElementById(document, "logout-btn");
} else {
unhideElementById(document, "joinnow-btn");
unhideElementById(document, "signin-btn");
}
if (saveBtn) {
saveBtn.addEventListener("click", (e) => {
e.preventDefault();