Created
October 24, 2018 19:36
-
-
Save productioncoder/d40b6ed11c81c9be6ae52f1a3573699e to your computer and use it in GitHub Desktop.
Youtube video categories reducer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {MOST_POPULAR, 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); | |
default: | |
return state; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment