aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/es6_browserified/actions/index.js60
-rw-r--r--app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js10
2 files changed, 37 insertions, 33 deletions
diff --git a/app/assets/javascripts/es6_browserified/actions/index.js b/app/assets/javascripts/es6_browserified/actions/index.js
index 41d57d28c..b92f9c913 100644
--- a/app/assets/javascripts/es6_browserified/actions/index.js
+++ b/app/assets/javascripts/es6_browserified/actions/index.js
@@ -1,30 +1,34 @@
-export const addStop = () => {
- return {
- type: 'ADD_STOP'
- }
-}
-export const moveStopUp = (index) => {
- return {
- type: 'MOVE_STOP_UP',
- index
- }
-}
-export const moveStopDown = (index) => {
- return {
- type: 'MOVE_STOP_DOWN',
- index
- }
-}
-export const deleteStop = (index) => {
- return {
- type: 'DELETE_STOP',
- index
- }
-}
-export const updateInputValue = (index, text) => {
- return {
- type : "UPDATE_INPUT_VALUE",
- index,
- text
+const actions = {
+ addStop : () => {
+ return {
+ type: 'ADD_STOP'
+ }
+ },
+ moveStopUp : (index) => {
+ return {
+ type: 'MOVE_STOP_UP',
+ index
+ }
+ },
+ moveStopDown : (index) => {
+ return {
+ type: 'MOVE_STOP_DOWN',
+ index
+ }
+ },
+ deleteStop : (index) => {
+ return {
+ type: 'DELETE_STOP',
+ index
+ }
+ },
+ updateInputValue : (index, text) => {
+ return {
+ type : "UPDATE_INPUT_VALUE",
+ index,
+ text
+ }
}
}
+
+export default actions
diff --git a/app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js b/app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js
index 7fb92bba5..4bb4e6c05 100644
--- a/app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js
+++ b/app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js
@@ -1,4 +1,4 @@
-import {toggleTodo, deleteStop, moveStopUp, moveStopDown, updateInputValue} from '../actions'
+import actions from '../actions'
import { connect } from 'react-redux'
import TodoList from '../components/TodoList'
@@ -11,16 +11,16 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
onDeleteClick: (index) =>{
- dispatch(deleteStop(index))
+ dispatch(actions.deleteStop(index))
},
onMoveUpClick: (index) =>{
- dispatch(moveStopUp(index))
+ dispatch(actions.moveStopUp(index))
},
onMoveDownClick: (index) =>{
- dispatch(moveStopDown(index))
+ dispatch(actions.moveStopDown(index))
},
onChange: (index, text) =>{
- dispatch(updateInputValue(index, text))
+ dispatch(actions.updateInputValue(index, text))
}
}
}