You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MovieFinder/redux/reducers/appReducer.tsx

22 lines
641 B

import {POP_FIRST_TRENDING, FETCH_TRENDING_MOVIE,FETCH_TRENDING_ID} from "../constants";
const initialState = {
trendingIDs: [],
trendingMovies: [],
}
// @ts-ignore
export default appReducer = (state = initialState, action) => {
switch (action.type) {
case FETCH_TRENDING_ID:
// @ts-ignore
return {...state, trendingIDs: action.payload};
case FETCH_TRENDING_MOVIE:
return {...state, trendingMovies: action.payload};
case POP_FIRST_TRENDING:
return {...state, trendingMovies: state.trendingMovies.pop()};
default:
return state;
}
}