title: In Redux-saga, how to call a saga in one saga's fetch?
body: <p>In my React app, there is a Saga calling backend API to retrieve some chart data. Please read the source code </p>
  
  <pre><code>function fetchData () {
      return fetch(`${config.base}dashboard_charts.json`)
      .then((response) =&gt; {
  
          if (response.status === 200) {
              return response.json();
          } else if (response.status === 403) {
               return 'logon';
          }
      });
  }
  
  function * getData (action) {
      try {
          const charts = yield call(fetchData);
  
          if (charts === 'logon') {
              yield logon();
          } else {
              yield put({ type: UPDATE_DASHBOARD_CHART, charts });
          }
      } catch (error) {
          yield put({ type: UPDATE_DASHBOARD_CHART, charts: [] });
      }
  }
  
  function * logon (action) {
      yield auth();
  }
  
  export default function * portfolio () {
      yield [
          takeEvery(FETCH_DASHBOARD_CHART, getData)
      ];
  };
  </code></pre>
  
  <p>There is a checking against the http response status in the function fetchData, if the status is 200 then return the response directly. But if the server side returns 403, it means the client needs to be authenticated, thus the program will goes to auth() and perform logon. </p>
  
  <p>However, the http response status code checking is somehow a general functionality applied to all API calls. So I don't want to repeat this kind of code in every saga. For this purpose, I wrote a service 'responseHandler' to group the response code checking inside like this:</p>
  
  <pre><code>export default function responseHandler (resp) {
      if (resp.status === 401 || resp.status === 403) {
          yield auth();
      } else if (resp.status === 200) {
  
      } else {
          console.log('error handling');
      }
  };
  </code></pre>
  
  <p>And it will be called inside the the fetchData</p>
  
  <pre><code>return fetch(`${config.base}dashboard_charts.json`)
      .then((response) =&gt; {
          responseHandler(response);
      });
  </code></pre>
  
  <p>But this approach is never working. 'yield auth()' is invalid in the responseHandler. </p>
  
  <p>Can anyone suggest how to better design the code for this case ?</p>