ngrx-examples icon indicating copy to clipboard operation
ngrx-examples copied to clipboard

ASYNC: postsByReddit reducer

Open tja4472 opened this issue 8 years ago • 1 comments

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;
    }
};

tja4472 avatar Jun 01 '16 15:06 tja4472

Yep, thanks! Will update soon 👍

btroncone avatar Jun 04 '16 01:06 btroncone