Skip to content

Instantly share code, notes, and snippets.

@chadoh
Created June 23, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chadoh/d75c671345a436bb913f to your computer and use it in GitHub Desktop.
Save chadoh/d75c671345a436bb913f to your computer and use it in GitHub Desktop.
/**
* 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