mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 05:30:13 +01:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user