mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 13:40:13 +01:00
38 lines
1.5 KiB
JavaScript
38 lines
1.5 KiB
JavaScript
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) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
export function unhideElementById(document, e) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
var element = document.getElementById(e);
|
|
if (element) {
|
|
element.classList.remove('hidden-before-load');
|
|
}
|
|
});
|
|
}
|
|
export function getEvent(id) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const res = yield fetch("/api/events/" + id);
|
|
if (!res.ok) {
|
|
throw Error("To wydarzenie nie istnieje");
|
|
}
|
|
const events = yield res.json();
|
|
return events;
|
|
});
|
|
}
|
|
export function getMyAccount() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const res = yield fetch("/api/auth/my_account");
|
|
if (!res.ok) {
|
|
throw Error("Użytkownik niezalogowany!");
|
|
}
|
|
const data = yield res.json();
|
|
return data;
|
|
});
|
|
}
|