File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,19 @@ var TodoActions = {
7
7
addTodo : ( todo ) => {
8
8
console . log ( "adding TODO" ) ;
9
9
api . addTodo ( todo )
10
+ . then ( ( ) => {
11
+ api . getTodos ( )
12
+ . then ( ( responseData ) => {
13
+ var todos = responseData . todos ;
14
+ console . log ( "All todos" , todos ) ;
15
+ TodoStore . setTodos ( todos ) ;
16
+ } )
17
+ } )
10
18
. then ( ( ) => {
11
19
console . log ( "Added TODO successfully" ) ;
12
- TodoActions . getAllTodosAndUpdateStore ( ) ;
20
+ AppDispatcher . dispatch ( {
21
+ actionType : 'TODO_ADD'
22
+ } ) ;
13
23
} )
14
24
} ,
15
25
@@ -50,18 +60,8 @@ var TodoActions = {
50
60
} )
51
61
} ,
52
62
53
- getAllTodosAndUpdateStore : ( ) => {
54
- console . log ( "Performing getAllTodos" ) ;
55
- api . getTodos ( )
56
- . then ( ( responseData ) => {
57
- var todos = responseData . todos ;
58
- console . log ( "new todos" , todos ) ;
59
- TodoStore . setTodos ( todos ) ;
60
- AppDispatcher . dispatch ( {
61
- actionType : 'TODO_ADD'
62
- } ) ;
63
- } )
64
- }
63
+
64
+
65
65
66
66
}
67
67
You can’t perform that action at this time.
0 commit comments