HTTP Status Codes
Last updated
Last updated
Add this plugin to keep track of status codes of your HTTP Requests on resource metadata. This is useful because status codes give you more detail information about your in-flight requests.
Note that you can simply use instead of this plugin. For instance:
This plugin is only useful when you specifically want to track the status on resource metadata.
Passing the status code looks like the following:
Within your resource metadata, the status code will be available at one of four keys, depending on the CRUD operation being performed:
createStatusCode
readStatusCode
updateStatusCode
deleteStatusCode
On a request object, the code is just available under statusCode
.
First, you need to register this plugin when you call .
This plugin doesn't come with any custom action types. Instead, it changes the way the state is tranformed with the built-in CRUD . Any time that you pass a statusCode
in an action with one of those types, then the code will be stored in your state tree.
If you're using the library, then you don't need to do anything differently: request status codes are already included in the actions dispatched from that library.