Skip to content

Instantly share code, notes, and snippets.

@kingsley-einstein
Created June 27, 2020 18:03
Show Gist options
  • Save kingsley-einstein/55f93c07f7bdcb50bae71ece1e57cb70 to your computer and use it in GitHub Desktop.
Save kingsley-einstein/55f93c07f7bdcb50bae71ece1e57cb70 to your computer and use it in GitHub Desktop.
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