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:
@@ -7,24 +7,29 @@ function toggleListSortOrder(org_id: number) {
|
||||
loadEvents(org_id);
|
||||
}
|
||||
|
||||
async function getEvents(titleOrDescription?: string) {
|
||||
async function getEvents(titleOrDescription?: string, fDate?: Date, tDate?: Date) {
|
||||
|
||||
var res: Response;
|
||||
var searchbar = document.getElementById("searchbar") as HTMLInputElement;
|
||||
|
||||
if (titleOrDescription == null) {
|
||||
res = await fetch("/api/events" + (isAscending ? "?sort=asc" : ""));
|
||||
if (!res.ok) throw new Error("Couldn't load events");
|
||||
} else {
|
||||
const payload = {
|
||||
titleOrDescription
|
||||
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 = await fetch('/api/events/search', {
|
||||
|
||||
res = await 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 = await res.json();
|
||||
return events;
|
||||
|
||||
Reference in New Issue
Block a user