File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1
1
var api = require ( "../utils/api" ) ;
2
2
var TodoStore = require ( "../stores/TodoStore" ) ;
3
+ var AppDispatcher = require ( '../dispatcher/AppDispatcher' ) ;
3
4
4
5
var TodoActions = {
5
6
@@ -26,7 +27,12 @@ var TodoActions = {
26
27
api . markTodoDone ( todo )
27
28
. then ( ( ) => {
28
29
console . log ( "marked TODO as done successfully" ) ;
29
- TodoStore . markTodoDone ( todo ) ;
30
+ //TodoStore.markTodoDone(todo);
31
+ AppDispatcher . dispatch ( {
32
+ actionType : 'TODO_DONE' ,
33
+ todo : todo
34
+ } ) ;
35
+
30
36
} )
31
37
} ,
32
38
Original file line number Diff line number Diff line change
1
+ var AppDispatcher = require ( '../dispatcher/AppDispatcher' ) ;
2
+
3
+ AppDispatcher . register ( function ( action ) {
4
+
5
+ switch ( action . actionType ) {
6
+ case 'TODO_DONE' :
7
+ console . log ( "Handling TODO_DONE using dispatcher in store" ) ;
8
+ break ;
9
+ }
10
+
11
+ } ) ;
12
+
1
13
var _todos = { } ;
2
14
var _callback ;
3
15
You can’t perform that action at this time.
0 commit comments