Skip to content

Commit 9b2f29e

Browse files
Update actions.ts (#56579)
fixed depricated nonempty()
1 parent bfc2ab9 commit 9b2f29e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/next-forms/app/actions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { z } from 'zod'
1111

1212
export async function createTodo(prevState: any, formData: FormData) {
1313
const schema = z.object({
14-
todo: z.string().nonempty(),
14+
todo: z.string().min(1),
1515
})
1616
const data = schema.parse({
1717
todo: formData.get('todo'),
@@ -32,8 +32,8 @@ export async function createTodo(prevState: any, formData: FormData) {
3232

3333
export async function deleteTodo(prevState: any, formData: FormData) {
3434
const schema = z.object({
35-
id: z.string().nonempty(),
36-
todo: z.string().nonempty(),
35+
id: z.string().min(1),
36+
todo: z.string().min(1),
3737
})
3838
const data = schema.parse({
3939
id: formData.get('id'),

0 commit comments

Comments
 (0)