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