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,3 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
console.log("TypeScript działa!");
import { getMyAccount, unhideElementById } from './generalUseHelpers.js';
function createEvent() {
return __awaiter(this, void 0, void 0, function* () {
// Pobieranie danych z formularza
@@ -49,6 +48,17 @@ function createEvent() {
}
document.addEventListener("DOMContentLoaded", () => {
const saveBtn = document.getElementById("saveBtn");
var user = yield 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();