Created
June 26, 2020 16:55
-
-
Save kingsley-einstein/3e36b2930affe044f5e57360d7a95895 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
import { UserState, initialUserState } from '../../states'; | |
import { UserActionTypes, UserActionUnion } from '../../actions'; | |
export default (state: UserState = initialUserState, action: UserActionUnion) : UserState => { | |
switch (action.type) { | |
case UserActionTypes.LoadUser: | |
return { | |
...state, | |
data: action.payload.data | |
}; | |
case UserActionTypes.LoadUsers: | |
return { | |
...state, | |
users: action.payload.data | |
}; | |
default: | |
return state; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment