Skip to content

Instantly share code, notes, and snippets.

@bnhansn
Created October 21, 2016 14:23
Show Gist options
  • Save bnhansn/3cbbdac8529b6709e6840f456dac5585 to your computer and use it in GitHub Desktop.
Save bnhansn/3cbbdac8529b6709e6840f456dac5585 to your computer and use it in GitHub Desktop.
const initialState = {
isAuthenticated: false,
currentUser: {},
};
export default function (state = initialState, action) {
switch (action.type) {
case 'AUTHENTICATION_SUCCESS':
return {
...state,
isAuthenticated: true,
currentUser: action.response.data,
};
case 'LOGOUT':
return {
...state,
isAuthenticated: false,
currentUser: {},
};
default:
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment