I have button which is making two calls in onClick, a function resetFilterItems which resets the filter in my state and simultaneously my getNetworkViewData is also api is also called.
I am not able to reset my filters firsts so making a call with incorrect payload. How can I first reset the filters props.filterStatus, props.filterCapabilities and then make a call synchronously in this situation?
<Button
type="secondary"
onClick={() => {
props.resetFilterItems(
props.filterStatus,
props.filterCapabilities
);
props.getNetworkViewData(
getSearchQueryParam(),
props.partnerId
);
}}
size="medium"
>
Clear all
</Button>