wedding-planner-frontend/app/api/tableSimulations.tsx
Manuel Bustillo 17b9a5e5b4
All checks were successful
Add copyright notice / copyright_notice (pull_request) Successful in 3m26s
Check usage of free licenses / build-static-assets (pull_request) Successful in 3m37s
Build Nginx-based docker image / build-static-assets (push) Successful in 40m57s
Playwright Tests / test (pull_request) Successful in 4m16s
Display simulation progress
2025-09-08 22:47:16 +02:00

23 lines
704 B
TypeScript

/* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/
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,
valid: record.valid,
progress: record.progress,
status : record.status
});
}));
}, (error) => {
return [];
});
}