ngrx-examples
ngrx-examples copied to clipboard
ASYNC: postsByReddit reducer
Should this be?
export interface RedditPostsArray {
[index: string]: RedditPosts;
}
export const postsByReddit: ActionReducer<RedditPostsArray> = (state: RedditPostsArray = {}, action: Action) => {
switch (action.type) {
case INVALIDATE_REDDIT:
case RECEIVE_POSTS:
case REQUEST_POSTS:
return <RedditPostsArray>Object.assign({}, state, {
[action.payload.reddit]: posts(state[action.payload.reddit], action)
});
default:
return state;
}
};
Yep, thanks! Will update soon 👍