Open melkir opened 1 year ago
I got the following zact code.
export const sendCommand = zact(ActionSchema)(async ({ command, led }) => { const res = await fetch(`${process.env.NEXT_HOST_URL}/gpio/command`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ command, led }), cache: 'no-store', }) return { status: res.status, statusText: res.statusText } })
This command might fails and when it does, I got something like this
error Error: connect ECONNREFUSED 127.0.0.1:5002
However, currently the message isn't passed to the client, so I tried to do
if (!res.ok) throw new Error(await res.text())
But it doesn't seems to work as wanted
const { mutate, error } = useZact(sendCommand) // error is null
I got the following zact code.
This command might fails and when it does, I got something like this
However, currently the message isn't passed to the client, so I tried to do
But it doesn't seems to work as wanted