feat: fix accounts issue.

This commit is contained in:
Ahmed Bouhuolia
2020-06-25 13:43:47 +02:00
parent 6074134a53
commit 111aa83908
46 changed files with 797 additions and 345 deletions

View File

@@ -1,10 +1,19 @@
import { createSelector } from 'reselect';
import { pickItemsFromIds } from 'store/selectors';
export const getAccountsItems = (state, viewId) => {
const accountsView = state.accounts.views[viewId || -1];
const accountsItems = state.accounts.items;
const accountsViewsSelector = (state) => state.accounts.views;
const accountsDataSelector = (state) => state.accounts.items;
const accountsCurrentViewSelector = (state) => state.accounts.currentViewId;
return typeof accountsView === 'object'
? pickItemsFromIds(accountsItems, accountsView.ids) || []
: [];
};
export const getAccountsItems = createSelector(
accountsViewsSelector,
accountsDataSelector,
accountsCurrentViewSelector,
(accountsViews, accountsItems, viewId) => {
const accountsView = accountsViews[viewId || -1];
return typeof accountsView === 'object'
? pickItemsFromIds(accountsItems, accountsView.ids) || []
: [];
},
);