Devendra174's picture
Upload folder using huggingface_hub
f5071ca verified
raw
history blame contribute delete
550 Bytes
import {
RECEIVE_COMMENTS,
RECEIVE_COMMENT,
REMOVE_COMMENT,
} from '../actions/comment_actions';
import merge from 'lodash/merge';
export default (state = {}, action) => {
Object.freeze(state);
let newState = merge({}, state);
switch (action.type) {
case RECEIVE_COMMENTS:
return action.comments;
case RECEIVE_COMMENT:
newState[action.comment.id] = action.comment;
return newState;
case REMOVE_COMMENT:
delete newState[action.commentId];
return newState;
default:
return state;
}
};