github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/blockapps-ba-master/ui/src/components/ErrorMessage/error-message.reducer.js (about)

     1  import * as ActionTypes from './error-message.action';
     2  
     3  // Updates error message to notify about the failed fetches.
     4  const errorMessageReducer = function(state = null, action) {
     5    const { type, error } = action;
     6  
     7    if (type === ActionTypes.RESET_ERROR_MESSAGE) {
     8      return null
     9    } else if (error) {
    10      return action.error
    11    }
    12  
    13    return state
    14  };
    15  
    16  export default errorMessageReducer;