github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/blockapps-ba-master/ui/src/scenes/Projects/components/ProjectCreate/reducers/project-create.reducer.js (about) 1 import { 2 PROJECT_CREATE, 3 PROJECT_CREATE_SUCCESS, 4 PROJECT_CREATE_FAILURE, 5 } from '../actions/project-create.actions'; 6 7 const initialState = { 8 project: null, 9 error: null, 10 }; 11 12 const reducer = function (state=initialState, action) { 13 // console.log('########################', action.type, state.nodes); 14 switch (action.type) { 15 case PROJECT_CREATE: 16 return initialState; 17 case PROJECT_CREATE_SUCCESS: 18 return { 19 project: action.project, 20 error: null, 21 }; 22 case PROJECT_CREATE_FAILURE: 23 return { 24 project: state.project, 25 error: action.error 26 }; 27 default: 28 return state; 29 } 30 }; 31 32 export default reducer;