hooked up create event
This commit is contained in:
@@ -68,7 +68,18 @@ export async function getCalendarEvent(id: number): Promise<CalendarEvent> {
|
||||
}
|
||||
|
||||
export async function createCalendarEvent(eventData: CalendarEvent) {
|
||||
let res = await fetch(`${addr}/calendar`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(eventData)
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
return;
|
||||
} else {
|
||||
throw new Error(`Failed to set attendance: ${res.status} ${res.statusText}`);
|
||||
}
|
||||
}
|
||||
|
||||
export async function editCalendarEvent(eventData: CalendarEvent) {
|
||||
@@ -84,14 +95,14 @@ export async function adminCancelCalendarEvent(eventID: number) {
|
||||
}
|
||||
|
||||
export async function setCalendarEventAttendance(eventID: number, state: CalendarAttendance) {
|
||||
let res = await fetch(`${addr}/calendar/ ${eventID}/attendance?state=${state}`, {
|
||||
let res = await fetch(`${addr}/calendar/${eventID}/attendance?state=${state}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
return;
|
||||
} else {
|
||||
} else {
|
||||
throw new Error(`Failed to set attendance: ${res.status} ${res.statusText}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user