Here is a snippet:
async function updateForm(data: FormData) {
"use server"
await updateTodo(data)
}
..from updatetodo.js
export async function updateTodo(data: FormData ) {
'use server'
const title = data.get("title")?.valueOf()
if (typeof title !== "string" || title.length === 0)
throw new Error('title issues')
const uid = data.get("id")?.valueOf()
if (typeof uid !== "string" || uid.length === 0)
throw new Error('uid issues')
await prisma.todo.update({ where: { id:uid }, data: { title } })
}
afterwards I have to refresh the browser for the new data to show in my UI?