title: Calling one async function inside another in redux-thunk
body: <p>I'm building a react app and use redux-thunk for async operations. I have two functions <code>getActivities()</code> and <code>createActivity()</code> and I want to call the former after successful calling the latter. But if I put <code>getActivities()</code> inside <code>then</code> block of <code>createActivity()</code> it simply isn't get called (which is proved by not seeing console.log() which I put in <code>getActivities()</code>). Here are both functions:</p>
  
  <pre><code>export const getActivities = () =&gt; dispatch =&gt; {
  console.log('again');
  return axios.get(ENV.stravaAPI.athleteActivitiesBaseEndPoint, autHeaders)
      .then(resp =&gt; {
          dispatch({type: actions.GET_ACTIVITIES, activities: resp.data})
      })
      .catch(err =&gt; {
          if(window.DEBUG)console.log(err);
      })
  };
  
  export const createActivity = data =&gt; dispatch =&gt; {
  
  dispatch(setLoadingElement('activityForm'));
  return axios.post(URL, null, autHeaders)
      .then(resp =&gt; {
          if (resp.status === 201) {
              dispatch(emptyModal());
          }
          // I WANT TO CALL getActivities() HERE
          dispatch(unsetLoadingElement('activityForm'));
      })
      .catch(err =&gt; {
          if(window.DEBUG) console.log(err.response.data.errors);
          dispatch(unsetLoadingElement('activityForm'));
      });
  };
  </code></pre>
  
  <p>How can I call one inside another?</p>