wedding-planner-frontend/app/api/tableSimulations.tsx
Manuel Bustillo 82f5dd6c64
Some checks failed
Check usage of free licenses / build-static-assets (pull_request) Successful in 44s
Add copyright notice / copyright_notice (pull_request) Successful in 54s
Playwright Tests / test (pull_request) Failing after 8m28s
Update navigation to accept the slug as part of the URL
2024-12-01 18:02:25 +01:00

20 lines
581 B
TypeScript

/* Copyright (C) 2024 Manuel Bustillo*/
import { TableArrangement } from '@/app/lib/definitions';
import { getSlug } from '../lib/utils';
export function loadTableSimulations(onLoad?: (tableSimulations: TableArrangement[]) => void) {
fetch(`/api/${getSlug()}/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 [];
});
}