Manuel Bustillo 54be5515e5
Some checks failed
Check usage of free licenses / build-static-assets (pull_request) Successful in 29s
Add copyright notice / copyright_notice (pull_request) Successful in 32s
Playwright Tests / test (pull_request) Failing after 5m1s
Update API routes to target the default tenant
2024-11-30 20:21:19 +01:00

27 lines
741 B
TypeScript

/* Copyright (C) 2024 Manuel Bustillo*/
import { Group } from '@/app/lib/definitions';
export function loadGroups(onLoad?: (groups: Group[]) => void) {
fetch("/api/default/groups")
.then((response) => response.json())
.then((data) => {
onLoad && onLoad(data.map((record: any) => {
return ({
id: record.id,
name: record.name,
color: record.color,
attendance: {
considered: record.considered,
invited: record.invited,
confirmed: record.confirmed,
tentative: record.tentative,
declined: record.declined,
total: record.total,
}
});
}));
}, (error) => {
return [];
});
}