Links
Comment on page

requestStatuses

An object that represents the four statuses that a request can have. The complete object is shown below:
{
IDLE: 'IDLE',
PENDING: 'PENDING',
FAILED: 'FAILED',
SUCCEEDED: 'SUCCEEDED',
}

Example

import { requestStatuses } from 'redux-resource';
import store from './store';
const state = store.getState();
if (state.books.meta['23'].readStatus === requestStatuses.PENDING) {
console.log('A book with id "23" is currently being fetched.');
}

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 5yr ago