/* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/ 'use client' import { AbstractApi } from '@/app/api/abstract-api'; import { Expense, ExpenseSerializer } from '@/app/lib/expense'; import { classNames } from '@/app/ui/components/button'; import ExpenseFormDialog from '@/app/ui/components/expense-form-dialog'; import ExpensesTable from '@/app/ui/expenses/table'; import SkeletonTable from '@/app/ui/guests/skeleton-row'; import { Suspense, useEffect, useState } from 'react'; export default function Page() { const refreshExpenses = () => { new AbstractApi().getAll(new ExpenseSerializer(), (expenses: Expense[]) => { setExpenses(expenses); }); } const [expenses, setExpenses] = useState([]); const [expenseBeingEdited, setExpenseBeingEdited] = useState(undefined); useEffect(() => { refreshExpenses() }, []); return (
{ refreshExpenses(); setExpenseBeingEdited(undefined) }} expense={expenseBeingEdited} visible={expenseBeingEdited !== undefined} onHide={() => { setExpenseBeingEdited(undefined) }} /> }> setExpenseBeingEdited(expense)} />
); }