mirror of
https://github.com/vercel/next-learn.git
synced 2026-06-11 09:51:47 +00:00
Fix
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
# `openssl rand -base64 32`
|
||||
AUTH_SECRET=
|
||||
@@ -31,7 +31,7 @@ export type State = {
|
||||
amount?: string[];
|
||||
status?: string[];
|
||||
};
|
||||
message?: string | undefined;
|
||||
message?: string | null;
|
||||
};
|
||||
|
||||
export async function createInvoice(prevState: State, formData: FormData) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import { createInvoice } from '@/app/lib/actions';
|
||||
import { useFormState } from 'react-dom';
|
||||
|
||||
export default function Form({ customers }: { customers: CustomerField[] }) {
|
||||
const initialState = { message: null, errors: [] };
|
||||
const initialState = { message: null, errors: {} };
|
||||
const [state, dispatch] = useFormState(createInvoice, initialState);
|
||||
|
||||
return (
|
||||
|
||||
@@ -19,7 +19,7 @@ export default function EditInvoiceForm({
|
||||
invoice: InvoiceForm;
|
||||
customers: CustomerField[];
|
||||
}) {
|
||||
const initialState = { message: null, errors: [] };
|
||||
const initialState = { message: null, errors: {} };
|
||||
const [state, dispatch] = useFormState(updateInvoice, initialState);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user