import * as ui from './../actions/ui' ; export interface State { rootTabIndex : number ; moviesCategory : "current" | "future" ; } export const initialState = { rootTabIndex : 0 , moviesCategory : "current" , } ; export function reducer ( state = initialState , actionRaw ) { switch ( actionRaw . type ) { case ui . ActionTypes . ROOT_CHANGE_TAB : { let action = < ui . RootChangeTabAction > actionRaw ; let newIndex = action . payload ; return { ... state , rootTabIndex : newIndex , } ; } case ui . ActionTypes . CHANGE_MOVIES_CATEGORY : { let action = < ui . ChangeMoviesCategoryAction > actionRaw ; return { ... state , moviesCategory : action . payload } ; } default : { return state ; } } } export const getRootTabIndex = ( state ) => state . rootTabIndex ; export const getMoviesCategory = ( state ) => state . moviesCategory ;