Created
June 23, 2015 14:02
-
-
Save chadoh/d75c671345a436bb913f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ToDo Actions | |
*/ | |
'use strict'; | |
var AppDispatcher = require('../dispatcher/AppDispatcher'); | |
var ActionConstants = require('../constants/ActionTypes'); | |
var ToDoApi = require('../utilities/ToDoApi'); | |
module.exports = { | |
// Receive inital ToDo data | |
receiveToDo: function(data) { | |
AppDispatcher.handleToDoAction({ | |
actionType: ActionConstants.TODO_RECEIVE_DATA, | |
data: data | |
}); | |
}, | |
// Add a new ToDo data | |
addToDo: function(data) { | |
AppDispatcher.handleToDoAction({ | |
actionType: ActionConstants.TODO_ADD, | |
data: data | |
}); | |
}, | |
// Request to mark ToDo as complete | |
requestToggleComplete: function(id) { | |
AppDispatcher.handleToDoAction({ | |
actionType: ActionConstants.TODO_TOGGLE_COMPLETE_REQUEST, | |
id: id | |
}); | |
ToDoApi.toggleCompleteById(id); | |
}, | |
// Mark ToDo as complete | |
toggleComplete: function(id) { | |
AppDispatcher.handleToDoAction({ | |
actionType: ActionConstants.TODO_TOGGLE_COMPLETE, | |
id: id | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment