title: Chaining Redux actions
body: <p>I am new to React, Redux and JS overall. I want to know how can I dispatch and action after another is finished - Promises in correct way. My code actually works but it keeps throwing error:</p>
  
  <pre><code>readingActions.js?14b9:56 Uncaught (in promise) TypeError: dispatch(...).then is not a function(…)
  </code></pre>
  
  <p>This is my setup.</p>
  
  <ul>
  <li><p>This is my action creator what I want chained action and where warning happends.</p>
  
  <pre><code>export function createReading(reading) {
    return function (dispatch) {
      dispatch({type: CREATE_READING});
      return request(
        `${API_URL}new`, {method: 'POST', body:JSON.stringify(reading)},
        (json) =&gt; {( dispatch({type: CREATE_READING_SUCCESS, res: json}).then(dispatch(Notifications.success(showSuccess(json.book.title)))))},
        (json) =&gt; { dispatch({type: CREATE_READING_ERROR400, res: json}).then(dispatch(Notifications.error(showError(json.error)))) },
        (res) =&gt; { dispatch({type: CREATE_READING_ERROR500, res: res}) },
        (ex) =&gt; { dispatch({type: CREATE_READING_FAILURE, error: ex}) },
      )
    }
  }
  </code></pre></li>
  </ul>
  
  <p>As you can see the problem is in .then, since I dont know how to trigger action correctly. </p>
  
  <ul>
  <li><p>You can also see request that is my helper function that looks like so (here I append token, return different responses):</p>
  
  <pre><code>export function request(url, options, success, error400, error, failure) {
      let headers = new Headers();
      headers.append("Content-Type", "application/json")
      headers.append("Accept", "application/json")
      options["headers"] = headers;
  
       if (localStorage.jwtToken) {
          let token = localStorage.jwtToken;
          headers.append('Authorization', 'JWT '+token);
       }
  
      return fetch(url, options)
          .then(res =&gt; {
              if (res.status &gt;= 200 &amp;&amp; res.status &lt; 300) {
                  res.json().then(json =&gt; {
                       return success(json)
                  })
              } else if (res.status === 400) {
                  res.json().then(json =&gt; {
                      return error400(json)
                  })
              } else {
                  return error(res)
              }
          }).catch((ex) =&gt; {
              return failure(ex)
          })
  }
  </code></pre></li>
  </ul>
  
  <p>Question is how can I execute proper .then and what would be the correct way?</p>