What would be the best solution to change my before implementation using Promise.all to the new one using Redux Tookit?!
My current implementation is:
Promise.all([
props.fetchDepartments(),
props.fetchVersions({ pageSize: 1000, pageNumber: 0 }),
])
.then((responses: [IDepartmentsState, IVersionsState]) => {
if (!isCancelled.current) {
const departments = responses[0].departments?.map(department => department.externalId) as string[];
const plan = responses[1].planVersions?.find(plan => plan.isActive && !plan.isLocked)?.id;
setLazyParams({ departments, plan });
}
return;
})
.catch(() => {
if (!isCancelled.current) {
showToastNotification('error', 'Error', props.translate('something_went_wrong'));
}
});
How can I change this based on Redux Toolkit? I tried to find some best practices in the documentation, but I didn't manage to find something related to this.