Modify the action for status update.

This commit is contained in:
gaba
2016-11-18 20:39:11 -08:00
parent 7c960e7118
commit 225592d7b5
3 changed files with 14 additions and 3 deletions
+1 -1
View File
@@ -3,6 +3,6 @@
*/
export const updateUserStatus = (status, id) => (dispatch, getState) => {
console.log('DEBUG ', getState);
dispatch({type: 'USER_STATUS_UPDATE', id, status});
dispatch({type: 'USER_UPDATE', user: getState().comments.get('byId').get(id)});
};
@@ -46,6 +46,17 @@ class ModerationQueue extends React.Component {
}
}
// Dispatch the appropiate action
onAction (status, id) {
switch(status){
case 'banned':
this.props.dispatch(updateUserStatus(status, id));
break;
default:
this.props.dispatch(updateStatus(status, id));
}
}
// Dispatch the update comment status action
onCommentAction (status, id) {
this.props.dispatch(updateStatus(status, id));
@@ -87,7 +98,7 @@ class ModerationQueue extends React.Component {
.get('status'))
}
comments={comments.get('byId')}
onClickAction={(action, id) => this.onCommentAction(action, id)}
onClickAction={(action, id) => this.onAction(action, id)}
actions={['reject', 'approve', 'ban']}
loading={comments.loading} />
</div>
+1 -1
View File
@@ -1,5 +1,5 @@
import {Map, List, fromJS} from 'immutable';
import {Map, List} from 'immutable';
const initialState = Map({
byId: Map(),