This commit is contained in:
2026-05-11 20:40:21 +03:00
parent d2d22799b6
commit d9ffcb4b92
15 changed files with 1652 additions and 1388 deletions
+4 -3
View File
@@ -1,5 +1,6 @@
'use client';
import { useFormState } from 'react-dom';
import { CustomerField } from '@/app/lib/definitions';
import Link from 'next/link';
import {
@@ -14,11 +15,11 @@ import { useActionState } from 'react';
export default function Form({ customers }: { customers: CustomerField[] }) {
const initialState: State = { message: null, errors: {} };
const [state, formAction] = useActionState(createInvoice, initialState);
const initialState = { message: '', error: {} };
const [state, dispatch] = useFormState(createInvoice, initialState);
return (
<form action={createInvoice}>
<form action={dispatch}>
<div className="rounded-md bg-gray-50 p-4 md:p-6">
{/* Customer Name */}
<div className="mb-4">