Created
June 27, 2020 18:03
-
-
Save kingsley-einstein/55f93c07f7bdcb50bae71ece1e57cb70 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 { PostState, initialPostState } from '../../states'; | |
import { PostActionTypes, PostActionUnion } from '../../actions'; | |
export default (state: PostState = initialPostState, action: PostActionUnion) : PostState => { | |
switch (action.type) { | |
case PostActionTypes.LoadPost: | |
return { | |
...state, | |
data: action.payload.data | |
}; | |
case PostActionTypes.LoadPosts: | |
return { | |
...state, | |
posts: action.payload.data | |
}; | |
default: | |
return state; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment