File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
ep28-more-dispatcher-usage/app Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,10 @@ var TodoActions = {
18
18
api . deleteTodo ( todo . id )
19
19
. then ( ( ) => {
20
20
console . log ( "Deleted TODO successfully" ) ;
21
- TodoStore . deleteTodo ( todo ) ;
21
+ AppDispatcher . dispatch ( {
22
+ actionType : 'TODO_DELETE' ,
23
+ todo : todo
24
+ } ) ;
22
25
} )
23
26
} ,
24
27
Original file line number Diff line number Diff line change @@ -9,9 +9,14 @@ AppDispatcher.register(function(action) {
9
9
break ;
10
10
11
11
case 'TODO_UNDONE' :
12
- console . log ( "Handling TODO_DONE using dispatcher in store" ) ;
12
+ console . log ( "Handling TODO_UNDONE using dispatcher in store" ) ;
13
13
TodoStore . markTodoUnDone ( action . todo ) ;
14
14
break ;
15
+
16
+ case 'TODO_DELETE' :
17
+ console . log ( "Handling TODO_DELETE using dispatcher in store" ) ;
18
+ TodoStore . deleteTodo ( action . todo ) ;
19
+ break ;
15
20
}
16
21
17
22
} ) ;
You can’t perform that action at this time.
0 commit comments