Closed m-anwr closed 7 months ago
AsyncData.status
is not the HTTP status code of the request, but the activity status of the request. It is one of idle
, pending
, success
, or error
. You can get the HTTP status code (albeit not reactively) using the onResponse()
callback.
useApiData("endpoint", {
onResponse(ctx) {
const status = ctx.response.status
console.log(`The status was: ${status}`)
}
}
@killjoy1221 Thanks a lot! I have added a dedicated page to the documentation. It will be live with the next major release.
Describe the feature
Currently when I do this:
I get
"success"
as long as no error happened, but I don't get any other valuesIt would be nice if we could get the status code by doing (for example):
status.value.code
Additional information
Final checks