Created
October 21, 2016 14:23
-
-
Save bnhansn/3cbbdac8529b6709e6840f456dac5585 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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