github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/blockapps-ba-master/ui/src/components/UserMessage/user-message.reducer.js (about) 1 import * as ActionTypes from './user-message.action'; 2 3 // Updates error message to notify about the failed fetches OR user notification message 4 const userMessageReducer = function(state = null, action) { 5 const { type, error } = action; 6 7 if (type === ActionTypes.RESET_USER_MESSAGE) { 8 return null; 9 } 10 else if (error) { 11 return action.error.message; 12 } 13 else if (type === ActionTypes.SET_USER_MESSAGE) { 14 return action.message; 15 } 16 return state; 17 }; 18 19 export default userMessageReducer;