src/internals/reactools/fetch/fetchStatusReducer.js
/**
 * Reducer factory for initializing the fetch status reducer
 * @param {object} metadata - root fetch metadata
 * @return {Function} - fetch status reducer
 *
 * TODO: rename fetchKey to fetchAttribute or something more meaningful
 */
Reducer factory for initializing the fetch status reducer
@param {object} metadata - root fetch metadata
@return {Function} - fetch status reducer

rename fetchKey to fetchAttribute or something more meaningful
Reducer factory for initializing the fetch status reducer @param { object } metadata - root fetch metadata @return { Function } - fetch status reducer rename fetchKey to fetchAttribute or something more meaningful
function createFetchStatusReducer(metadata) {
  return (state = {}, action) => {
    if (!action.key || !metadata[action.key]) return state;
    const fetchKey = metadata[action.key].fetchKey;
    switch (action.type) {
      case REDUX_ACTIONS.FETCH_INIT:
        return getState(fetchKey, state, action, FETCH_STATUSES.IN_PROGRESS);
      case REDUX_ACTIONS.FETCH_SUCCESS:
        return getState(fetchKey, state, action, FETCH_STATUSES.SUCCESS);
      case REDUX_ACTIONS.FETCH_FAILED:
        return getState(fetchKey, state, action, FETCH_STATUSES.FAILED);
      default:
        return state;
    }
  };
}
function createFetchStatusReducer ( metadata ) { return ( state = { } , action ) => { if ( ! action . key || ! metadata [ action . key ] ) return state ; const fetchKey = metadata [ action . key ] . fetchKey ; switch ( action . type ) { case REDUX_ACTIONS . FETCH_INIT : return getState ( fetchKey , state , action , FETCH_STATUSES . IN_PROGRESS ) ; case REDUX_ACTIONS . FETCH_SUCCESS : return getState ( fetchKey , state , action , FETCH_STATUSES . SUCCESS ) ; case REDUX_ACTIONS . FETCH_FAILED : return getState ( fetchKey , state , action , FETCH_STATUSES . FAILED ) ; default : return state ; } } ; }
Reducer factory for initializing the fetch status reducer
 @param {object} metadata - root fetch metadata
 @return {Function} - fetch status reducer
Reducer factory for initializing the fetch status reducer @param { object } metadata - root fetch metadata @return { Function } - fetch status reducer