17 lines
487 B
TypeScript
17 lines
487 B
TypeScript
|
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 [];
|
||
|
});
|
||
|
}
|