Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASYNC: postsByReddit reducer #11

Open
tja4472 opened this issue Jun 1, 2016 · 1 comment
Open

ASYNC: postsByReddit reducer #11

tja4472 opened this issue Jun 1, 2016 · 1 comment

Comments

@tja4472
Copy link

tja4472 commented Jun 1, 2016

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;
    }
};
@btroncone
Copy link
Owner

Yep, thanks! Will update soon 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants