Files
freeCodeCamp/common/app/routes/settings/redux/actions.js
Berkeley Martinez 0d3dd75f41 Feature(settings): add user flag logic
This also moves a couple of settings to their own controller
2016-07-28 23:40:01 -07:00

31 lines
710 B
JavaScript

import { createAction, handleActions } from 'redux-actions';
import createTypes from '../../../utils/create-types';
const initialState = {
showDeleteModal: false
};
export const types = createTypes([
'toggleUserFlag',
'openDeleteModal',
'hideDeleteModal'
], 'settings');
export const toggleUserFlag = createAction(types.toggleUserFlag);
export const openDeleteModal = createAction(types.openDeleteModal);
export const hideDeleteModal = createAction(types.hideDeleteModal);
export default handleActions(
{
[openDeleteModal]: state => ({
...state,
isDeleteOpen: true
}),
[hideDeleteModal]: state => ({
...state,
isDeleteOpen: false
})
},
initialState
);