Files
talk/plugins/talk-plugin-moderation-actions/client/reducer.js
T
Belen Curcio 8bfc7e942c Renaming
2017-09-18 10:04:39 -03:00

38 lines
721 B
JavaScript

import {OPEN_MENU, CLOSE_MENU, OPEN_DIALOG, CLOSE_DIALOG} from './constants';
const initialState = {
showMenuForComment: null,
showDialog: false,
comment: null
};
export default function reducer(state = initialState, action) {
switch (action.type) {
case OPEN_MENU:
return {
...state,
showMenuForComment: action.id
};
case CLOSE_MENU:
return {
...state,
showMenuForComment: null
};
case OPEN_DIALOG:
return {
...state,
showDialog: true,
commentId: action.commentId,
authorId: action.authorId
};
case CLOSE_DIALOG:
return {
...state,
showDialog: false,
comment: null
};
default :
return state;
}
}