mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 13:40:13 +01:00
Add log in / log off in calendar
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { unhideElementById, getMyAccount } from './generalUseHelpers.js';
|
||||
|
||||
|
||||
async function getRegisteredEvents(): Promise<any[]> {
|
||||
const res = await fetch("/api/events/registered");
|
||||
if (!res.ok) throw new Error("Couldn't load joined events");
|
||||
@@ -12,6 +15,17 @@ async function getRegisteredEvents(): Promise<any[]> {
|
||||
|
||||
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
|
||||
try {
|
||||
var user = await getMyAccount();
|
||||
if (user) {
|
||||
unhideElementById(document, "logout-btn");
|
||||
}
|
||||
} catch {
|
||||
unhideElementById(document, "joinnow-btn");
|
||||
unhideElementById(document, "signin-btn");
|
||||
}
|
||||
|
||||
const calendarEl = document.getElementById("calendar") as HTMLElement;
|
||||
if (!calendarEl) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user