Created
June 12, 2019 10:51
-
-
Save panvourtsis/5f2aff1a7fde808d0df088a865bbd783 to your computer and use it in GitHub Desktop.
This file contains 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
import { SET_USER, SET_USER_TOKEN, UNSET_USER, UserActionTypes } from './types'; | |
import { User } from './types'; | |
const initialState: User = { | |
id: null, | |
name: '', | |
email: '', | |
}; | |
function userInfo(state = initialState, action: UserActionTypes): User { | |
switch (action.type) { | |
case SET_USER_TOKEN: | |
return { | |
...state, | |
token: action.payload, | |
}; | |
default: | |
return state; | |
} | |
} | |
export default userInfo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment