You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was running into an issue when our backend openapi spec'd response for an endpoint was a 204 No Content success status. The client side code was throwing an error so we couldn't trigger the onSuccess function through the react query component. The error was the following thrown in the autogenerated fetcher script:
message: "Network error (Unexpected end of JSON input)"name: "unknown"stack: SyntaxError: Unexpected end of JSON input
Workaround
Check the response status in the fetcher AFTER the fetch, e.g.
if (response.status === 204) {
return {} as TData;
}
Could also return null or something else you want.
The text was updated successfully, but these errors were encountered:
Problem
Was running into an issue when our backend openapi spec'd response for an endpoint was a 204 No Content success status. The client side code was throwing an error so we couldn't trigger the
onSuccess
function through the react query component. The error was the following thrown in the autogenerated fetcher script:Workaround
Check the response status in the fetcher AFTER the fetch, e.g.
Could also return
null
or something else you want.The text was updated successfully, but these errors were encountered: