I'm doing a GetList api call and after I get response I'm making another api call. dispatchUpdateHeader should happen after all the calls are done. But its not working. Is it good idea to write too many .thens?
export const getList = (data) => {
return (dispatch) => {
const { url, params } = GetList(data.items);
return fetch(url, params)
.then(() => {
dispatch(getSavedItems(data.reqBody));
const { url1, params1 } = UpdateItemsApi();
return fetch(url1, params1).then(() => {
dispatchUpdateHeader();
});
});
};
};