github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/blockapps-ba-master/ui/src/components/ExplorerUrl/explorer.reducer.js (about) 1 import { 2 GET_EXPLORER_URL, 3 GET_EXPLORER_URL_SUCCESS, 4 GET_EXPLORER_URL_FAILURE 5 } from './explorer.actions'; 6 7 const initialState = { 8 explorerUrl: null, 9 error: null, 10 }; 11 12 const reducer = function explorerUrlReducer (state = initialState, action) { 13 switch(action.type) { 14 case GET_EXPLORER_URL: 15 return initialState; 16 case GET_EXPLORER_URL_SUCCESS: 17 return { 18 explorerUrl: action.explorerUrl, 19 error: null, 20 }; 21 case GET_EXPLORER_URL_FAILURE: 22 return { 23 explorerUrl: null, 24 error: action.error, 25 }; 26 default: 27 return state; 28 } 29 }; 30 31 export default reducer;