title: How to wait for a saga to finish calling an api to execute a next function?
body: <p>I have a question regarding the use of sagas.</p>
  
  <p>I have a button that when clicked, triggers a function that calls an action:</p>
  
  <p><strong>Component.js</strong></p>
  
  <pre><code>  onClickChainIdentifier = (event) =&gt; {
       //action called
        this.props.getChains();
  
       //next function to be called
        this.teste();
      }
    }
  </code></pre>
  
  <p><strong><em>Action.js</em></strong></p>
  
  <pre><code>export function getChains(){
    return {
      type: GET_CHAINS,
    }
  }
  </code></pre>
  
  <p>When this action is dispatched, it fires a constant GET_CHAINS, which calls a saga:</p>
  
  <p><strong>Saga.js</strong></p>
  
  <pre><code>export function* getAllChains() {
    const requestURL = process.env.PATH_API.GET_CHAINS;
  
    try {
      const response = yield call(requestGet, requestURL);
      yield put(getChainsSuccess(response));
    } catch (err) {
      yield put(getChainsError(err));
    }
  }
  
  
  export default function* sagasApp() {
  
  yield [
      fork( takeLatest, GET_CHAINS, getAllChains ),
    ]
  }
  </code></pre>
  
  <p>I would like that after the api return (of success or error), I could call the <strong>this.teste</strong> function that is inside the component.
  How do I make this happen?</p>
  
  <p>Thanks in advance for your help.</p>