Saurabh Shetty
Saurabh Shetty

Reputation: 3

How can i call a saga for an api call while it is running the previous call?

So the second action is being called while 1st action is running in saga. I do get the response of the 1st action but not that of the second one.

this.props.actions.FetchRequest(payload1)
this.props.actions.FetchRequest(payload2)

Upvotes: 0

Views: 39

Answers (1)

Sultan Aslam
Sultan Aslam

Reputation: 6238

There are two saga helpers takeevery and takelatest

takeevery is use to perform on every dispatched actions and

takeLatest is use to perform task only latest dispatched action and cancels any pending task started previously.

Docs: https://redux-saga.js.org/docs/api/

Upvotes: 1

Related Questions