if (action.type == types.FILTER_TITLE_CHANGED) {
let newState = { ...state };
newState.filterTitleStr = action.filterTitleStr;
return newState;
} else if (action.type == types.FILTER_AUTHOR_CHANGED) {
let newState = { ...state };
newState.filterAuthorStr = action.filterAuthorStr;
return newState;
} else if (action.type == types.FILTER_CATEGORY_CHANGED) {
let newState = { ...state };
newState.filterCategoryStr = action.filterCategoryStr;
return newState;
}
import * as ActionTypes from './ActionTypes';
export const comments = (state = { errMess: null, comments: []}, action) => {
switch (action.type) {
case ActionTypes.ADD_COMMENTS:
return {...state, errMess: null, comments: action.payload};
case ActionTypes.COMMENTS_FAILED:
return {...state, errMess: action.payload};
default:
return state;
}
};