23 lines
		
	
	
		
			729 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			729 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?limit=3&status=completed`)
 | |
|     .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 [];
 | |
|     });
 | |
| } |