How do you expect a saga to finish running the whole cycle to perform a next function?

0

Good afternoon,

I have a question regarding the use of sagas.

I have a button that when clicked, triggers a function that calls an action:

  onClickChainIdentifier = (event) => {
     //action disparada
      this.props.getChains();

     //função seguinte a ser chamada
      this.teste();
    }
  }

When this action is dispatched, it triggers a constant GET_CHAINS , which calls a saga:

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 ),
  ]
}

I would like this saga to be executed, and then the function onClickChainIdentifier () , the this.teste () function to execute.

How do I make this happen?

Thank you in advance for your help.

    
asked by anonymous 17.12.2018 / 21:10

0 answers