Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Last active October 28, 2018 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save productioncoder/7dabb89ae7f9f105f050e01b615404db to your computer and use it in GitHub Desktop.
Save productioncoder/7dabb89ae7f9f105f050e01b615404db to your computer and use it in GitHub Desktop.
Youtube update videos reducer with most popular videos by category action
import {MOST_POPULAR, MOST_POPULAR_BY_CATEGORY, VIDEO_CATEGORIES} from '../actions/video';
import {SUCCESS} from '../actions';
import {createSelector} from 'reselect';
const initialState = {
byId: {},
mostPopular: {},
categories: {},
};
export default function videos(state = initialState, action) {
switch (action.type) {
case MOST_POPULAR[SUCCESS]:
return reduceFetchMostPopularVideos(action.response, state);
case VIDEO_CATEGORIES[SUCCESS]:
return reduceFetchVideoCategories(action.response, state);
case MOST_POPULAR_BY_CATEGORY[SUCCESS]:
return reduceFetchMostPopularVideosByCategory(action.response, action.categories, state);
default:
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment