requestStatuses
An object that represents the four statuses that a request can have. The complete object is shown below:
1
{
2
IDLE: 'IDLE',
3
PENDING: 'PENDING',
4
FAILED: 'FAILED',
5
SUCCEEDED: 'SUCCEEDED',
6
}
Copied!

Example

1
import { requestStatuses } from 'redux-resource';
2
import store from './store';
3
4
const state = store.getState();
5
6
if (state.books.meta['23'].readStatus === requestStatuses.PENDING) {
7
console.log('A book with id "23" is currently being fetched.');
8
}
Copied!

Tips

  • Although this object can be used to check the status of a request in your
    view layer, it's often more convenient to use getStatus
    for that purpose. For this reason, we recommend restricting your usage of this
    object to plugins, reducers, or action creators.
Last modified 4yr ago
Copy link
Contents
Example
Tips