Add applying to event

This commit is contained in:
AleksDw
2025-06-01 17:13:47 +02:00
parent b440a0334c
commit 7e3759927f
5 changed files with 104 additions and 13 deletions

View File

@@ -36,9 +36,20 @@ export async function getEvent(id: string): Promise<EventData> {
export async function getMyAccount(): Promise<MyAccount> {
const res = await fetch("/api/auth/my_account");
if (!res.ok) {
throw Error("U¿ytkownik niezalogowany!");
throw Error("U<EFBFBD>ytkownik niezalogowany!");
}
const data = await res.json();
return data;
}
export async function getMyRegisteredEventIds(): Promise<number[]> {
const res = await fetch("/api/auth/my_events");
if (!res.ok) {
throw Error("Użytkownik niezalogowany!");
}
const events = await res.json();
return events.map((event: { eventId: number }) => event.eventId);
}