mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 13:40:13 +01:00
fix auth.ts
This commit is contained in:
@@ -49,9 +49,6 @@ function setupAuthUI(): void {
|
|||||||
logoutBtn.addEventListener('click', logoutUser);
|
logoutBtn.addEventListener('click', logoutUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide all auth buttons initially until DOM loads
|
|
||||||
const hiddenBeforeLoad = document.querySelectorAll('.hidden-before-load');
|
|
||||||
hiddenBeforeLoad.forEach(el => el.classList.remove('hidden-before-load'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize on load
|
// Initialize on load
|
||||||
|
|||||||
@@ -38,9 +38,6 @@ function setupAuthUI() {
|
|||||||
logoutBtn.classList.toggle('d-none', !isAuthenticated);
|
logoutBtn.classList.toggle('d-none', !isAuthenticated);
|
||||||
logoutBtn.addEventListener('click', logoutUser);
|
logoutBtn.addEventListener('click', logoutUser);
|
||||||
}
|
}
|
||||||
// Hide all auth buttons initially until DOM loads
|
|
||||||
const hiddenBeforeLoad = document.querySelectorAll('.hidden-before-load');
|
|
||||||
hiddenBeforeLoad.forEach(el => el.classList.remove('hidden-before-load'));
|
|
||||||
}
|
}
|
||||||
// Initialize on load
|
// Initialize on load
|
||||||
document.addEventListener('DOMContentLoaded', setupAuthUI);
|
document.addEventListener('DOMContentLoaded', setupAuthUI);
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ document.addEventListener("DOMContentLoaded", () => __awaiter(void 0, void 0, vo
|
|||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
if (container !== null)
|
if (container !== null)
|
||||||
container.innerHTML = `<p class="text-danger">To wydarzenie nie istnieje! <a href="/" style="color:#2898BD;">Powr<EFBFBD>t -></a></p>`;
|
container.innerHTML = `<p class="text-danger">To wydarzenie nie istnieje! <a href="/" style="color:#2898BD;">Powrót -></a></p>`;
|
||||||
}
|
}
|
||||||
if (thisEvent == null) {
|
if (thisEvent == null) {
|
||||||
if (container !== null)
|
if (container !== null)
|
||||||
container.innerHTML = `<p class="text-danger">B<EFBFBD><EFBFBD>d we wczytywaniu wydarzenia. <a href="/" style="color:#2898BD;">Powr<EFBFBD>t -></a></p>`;
|
container.innerHTML = `<p class="text-danger">Błąd we wczytywaniu wydarzenia. <a href="/" style="color:#2898BD;">Powrót -></a></p>`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const titleText = document.getElementById("titleText");
|
const titleText = document.getElementById("titleText");
|
||||||
@@ -56,13 +56,13 @@ document.addEventListener("DOMContentLoaded", () => __awaiter(void 0, void 0, vo
|
|||||||
dateText.innerHTML = "When: " + newdateText + " " + newtimeText; //thisEvent.eventDate;
|
dateText.innerHTML = "When: " + newdateText + " " + newtimeText; //thisEvent.eventDate;
|
||||||
organizerText.innerHTML = "Organized by: " + thisEvent.organisationName;
|
organizerText.innerHTML = "Organized by: " + thisEvent.organisationName;
|
||||||
if (org_id == thisEvent.organisationId) {
|
if (org_id == thisEvent.organisationId) {
|
||||||
// U<EFBFBD>ytkownik jest organizacj<EFBFBD>, kt<EFBFBD>ra
|
// Użytkownik jest organizacją, która
|
||||||
// stworzy<EFBFBD>a to wydarzenie
|
// stworzyła to wydarzenie
|
||||||
unhideElementById(document, "editBtn");
|
unhideElementById(document, "editBtn");
|
||||||
unhideElementById(document, "removeBtn");
|
unhideElementById(document, "removeBtn");
|
||||||
}
|
}
|
||||||
else if (org_id == -1) {
|
else if (org_id == -1) {
|
||||||
// U<EFBFBD>ytkownik jest wolontariuszem
|
// Użytkownik jest wolontariuszem
|
||||||
unhideElementById(document, "applyBtn");
|
unhideElementById(document, "applyBtn");
|
||||||
}
|
}
|
||||||
unhideElementById(document, "mainContainer");
|
unhideElementById(document, "mainContainer");
|
||||||
@@ -78,7 +78,7 @@ document.addEventListener("DOMContentLoaded", () => __awaiter(void 0, void 0, vo
|
|||||||
if (!confirmed)
|
if (!confirmed)
|
||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
// Wysy<EFBFBD>a <EFBFBD><EFBFBD>danie DELETE do API
|
// Wysyła żądanie DELETE do API
|
||||||
const response = yield fetch(`/api/events/${eventId}`, {
|
const response = yield fetch(`/api/events/${eventId}`, {
|
||||||
method: "DELETE"
|
method: "DELETE"
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user