mirror of
https://github.com/wassname/talk.git
synced 2026-06-28 16:14:49 +08:00
43 lines
883 B
JavaScript
43 lines
883 B
JavaScript
import {OPEN_MENU, CLOSE_MENU, OPEN_BAN_DIALOG, CLOSE_BAN_DIALOG} from './constants';
|
|
|
|
const initialState = {
|
|
showMenuForComment: null,
|
|
showBanDialog: false,
|
|
authorId: null,
|
|
commentId: null,
|
|
commentStatus: 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_BAN_DIALOG:
|
|
return {
|
|
...state,
|
|
showBanDialog: true,
|
|
authorId: action.authorId,
|
|
commentId: action.commentId,
|
|
commentStatus: action.commentStatus
|
|
};
|
|
case CLOSE_BAN_DIALOG:
|
|
return {
|
|
...state,
|
|
showBanDialog: false,
|
|
authorId: null,
|
|
commentId: null,
|
|
commentStatus: null
|
|
};
|
|
default :
|
|
return state;
|
|
}
|
|
}
|