@@ -69,31 +69,31 @@ For async action creators using [Redux Thunk](https://github.com/gaearon/redux-t
6969``` js 
7070function  fetchTodosRequest () {
7171  return  {
72-     type:  ADD_TODOS_REQUEST 
72+     type:  FETCH_TODOS_REQUEST 
7373  };
7474}
7575
7676function  fetchTodosSuccess (body ) {
7777  return  {
78-     type:  ADD_TODOS_SUCCESS ,
78+     type:  FETCH_TODOS_SUCCESS ,
7979    body
8080  };
8181}
8282
8383function  fetchTodosFailure (ex ) {
8484  return  {
85-     type:  ADD_TODOS_FAILURE ,
85+     type:  FETCH_TODOS_FAILURE ,
8686    ex
8787  };
8888}
8989
90- export  function  fetchTodos (data ) {
90+ export  function  fetchTodos () {
9191  return  dispatch  =>  {
9292    dispatch (fetchTodosRequest ());
9393    return  fetch (' http://example.com/todos'  )
9494      .then (res  =>  res .json ())
95-       .then (json  =>  dispatch (addTodosSuccess (json .body )))
96-       .catch (ex  =>  dispatch (addTodosFailure (ex)));
95+       .then (json  =>  dispatch (fetchTodosSuccess (json .body )))
96+       .catch (ex  =>  dispatch (fetchTodosFailure (ex)));
9797  };
9898}
9999``` 
@@ -131,7 +131,7 @@ function mockStore(getState, expectedActions, done) {
131131
132132      dispatch (action ) {
133133        const  expectedAction  =  expectedActions .shift ();
134-          
134+ 
135135        try  {
136136          expect (action).toEqual (expectedAction);
137137          if  (done &&  ! expectedActions .length ) {
@@ -157,14 +157,14 @@ describe('async actions', () => {
157157    nock .cleanAll ();
158158  });
159159
160-   it (' creates FETCH_TODO_SUCCESS  when fetching todos has been done'  , (done ) =>  {
160+   it (' creates FETCH_TODOS_SUCCESS  when fetching todos has been done'  , (done ) =>  {
161161    nock (' http://example.com/'  )
162162      .get (' /todos'  )
163163      .reply (200 , { todos:  [' do something'  ] });
164164
165165    const  expectedActions  =  [
166-       { type:  types .FETCH_TODO_REQUEST  },
167-       { type:  types .FETCH_TODO_SUCCESS , body:  { todos:  [' do something'  ]  } }
166+       { type:  types .FETCH_TODOS_REQUEST  },
167+       { type:  types .FETCH_TODOS_SUCCESS , body:  { todos:  [' do something'  ]  } }
168168    ]
169169    const  store  =  mockStore ({ todos:  [] }, expectedActions, done);
170170    store .dispatch (actions .fetchTodos ());
0 commit comments