mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 05:30:13 +01:00
feat: user page with volunteerskills picking support
This commit is contained in:
@@ -13,26 +13,27 @@ function toggleListSortOrder(org_id) {
|
||||
isAscending = !isAscending;
|
||||
loadEvents(org_id);
|
||||
}
|
||||
function getEvents(titleOrDescription) {
|
||||
function getEvents(titleOrDescription, fDate, tDate) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var res;
|
||||
var searchbar = document.getElementById("searchbar");
|
||||
if (titleOrDescription == null) {
|
||||
res = yield fetch("/api/events" + (isAscending ? "?sort=asc" : ""));
|
||||
if (!res.ok)
|
||||
throw new Error("Couldn't load events");
|
||||
}
|
||||
else {
|
||||
const payload = {
|
||||
titleOrDescription
|
||||
};
|
||||
res = yield fetch('/api/events/search', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
if (!res.ok)
|
||||
throw new Error("Failed to get search results");
|
||||
titleOrDescription = searchbar.value;
|
||||
//res = await fetch("/api/events" + (isAscending ? "?sort=asc" : ""));
|
||||
//if (!res.ok) throw new Error("Couldn't load events");
|
||||
}
|
||||
var payload = {
|
||||
titleOrDescription,
|
||||
fDate,
|
||||
tDate
|
||||
};
|
||||
res = yield fetch('/api/events/search' + (isAscending ? "?sort=asc" : ""), {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
if (!res.ok)
|
||||
throw new Error("Failed to get search results");
|
||||
const events = yield res.json();
|
||||
return events;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user