function expectOk expectOk<T>(res: Response): Promise<T> Returns the payload of res. In a form, the error it throws reaches useApiForm's submit, which shows it as the form's error. Type Parameters T Parameters res: Response Return Type Promise<T> Throws Error With the server's message when the response says success: false, and when the body isn't JSON or isn't an envelope.