Skip to content

Instantly share code, notes, and snippets.

@rafael-metractive
Created February 19, 2019 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafael-metractive/e62a9184de67cde4aedc7f90d1563869 to your computer and use it in GitHub Desktop.
Save rafael-metractive/e62a9184de67cde4aedc7f90d1563869 to your computer and use it in GitHub Desktop.
const USER_SET = 'USER_SET';
const USER_SET_STATE = 'USER_SET_STATE';
const initialState = {
user: {},
loading: false
};
export default (state = initialState, action = {}) => {
switch (action.type) {
case USER_SET:
return { ...state, user: action.data };
case USER_SET_STATE:
return { ...state, loading: action.state };
default:
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment