The test condition is that we are calling 3-4 API's at a time one after another and the API's take time to load a bit. During that time if we press the back button or any other UI component it responds after all the API has been called. So I want to cancel the API on button click.
export function* getData(api, action) {
const { location } = action;
// make the call to the api
const response = yield call(api.daily, location);
if (response.status === 200) {
// do data conversion here if needed
yield put(LocationActions.Success(response.data));
} else {
const error = errorType(response);
yield put(Actions.Failure(error));
}
}