react-redux-fetch
Version:
A declarative and customizable way to fetch data for React components and manage that data in the Redux state
12 lines (9 loc) • 368 B
Flow
import immutable from 'seamless-immutable';
import { PENDING } from '../constants/request';
const fetchRequest = (state, action) => {
if (state.value && !action.request.clearValueOnRequest) {
return state.merge(PENDING).setIn(['meta'], action.request.meta);
}
return immutable(PENDING).setIn(['meta'], action.request.meta);
};
export default fetchRequest;