Response Body in Error with useFetch
π,
I get the following error in an API request (see attachment).
Is there a way to get the response body using
useFetch
?
I have tried using interceptors but no luck so far. The status code and status message are fine, but the response body is nowhere to be found.![No description](https://answer-overflow-discord-attachments.s3.us-east-1.amazonaws.com/1257334965947863132/api-request.png)
2 Replies
You can get both the body and error by destructuring the return value of the
useFetch
promise.
Thank you! I solved it and it was one of these face palm moments π³ I simply forgot to add it to my error object (server error > fetch error in my store > error display on page)