Skip to content

Commit 06b99ec

Browse files
delete TODO
1 parent 6c4b2a8 commit 06b99ec

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

ep28-more-dispatcher-usage/app/actions/TodoActions.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ var TodoActions = {
1818
api.deleteTodo(todo.id)
1919
.then( () => {
2020
console.log("Deleted TODO successfully");
21-
TodoStore.deleteTodo(todo);
21+
AppDispatcher.dispatch({
22+
actionType: 'TODO_DELETE',
23+
todo: todo
24+
});
2225
})
2326
},
2427

ep28-more-dispatcher-usage/app/stores/TodoStore.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ AppDispatcher.register(function(action) {
99
break;
1010

1111
case 'TODO_UNDONE':
12-
console.log("Handling TODO_DONE using dispatcher in store");
12+
console.log("Handling TODO_UNDONE using dispatcher in store");
1313
TodoStore.markTodoUnDone(action.todo);
1414
break;
15+
16+
case 'TODO_DELETE':
17+
console.log("Handling TODO_DELETE using dispatcher in store");
18+
TodoStore.deleteTodo(action.todo);
19+
break;
1520
}
1621

1722
});

0 commit comments

Comments
 (0)