wedding-planner-frontend/app/api/tableSimulations.tsx
Manuel Bustillo 2225fdc7d2
Some checks failed
Check usage of free licenses / build-static-assets (pull_request) Failing after 15s
Add copyright notice / copyright_notice (pull_request) Failing after 15s
Playwright Tests / test (pull_request) Failing after 3m56s
Add copyright notice
2024-11-17 16:00:30 +00:00

19 lines
528 B
TypeScript

/* Copyright (C) 2024 Manuel Bustillo*/
import { TableArrangement } from '@/app/lib/definitions';
export function loadTableSimulations(onLoad?: (tableSimulations: TableArrangement[]) => void) {
fetch('/api/tables_arrangements')
.then((response) => response.json())
.then((data) => {
onLoad && onLoad(data.map((record: any) => {
return ({
id: record.id,
name: record.name,
discomfort: record.discomfort,
});
}));
}, (error) => {
return [];
});
}