Refactor getOtherAccounts selector

This commit is contained in:
Alex Gleason
2021-07-10 04:48:12 -05:00
parent 079e269812
commit 4e3c002f8a
3 changed files with 16 additions and 22 deletions

View File

@ -197,16 +197,18 @@ export const makeGetReport = () => {
};
export const makeGetOtherAccounts = () => {
return createSelector(
[(accounts, authUsers, me) => {
return authUsers
.keySeq()
.reduce((list, id) => {
if (id === me) return list;
const account = accounts.get(id);
return account ? list.push(account) : list;
}, ImmutableList());
}],
otherAccounts => otherAccounts,
);
return createSelector([
state => state.get('accounts'),
state => state.getIn(['auth', 'users']),
state => state.get('me'),
],
(accounts, authUsers, me) => {
return authUsers
.keySeq()
.reduce((list, id) => {
if (id === me) return list;
const account = accounts.get(id);
return account ? list.push(account) : list;
}, ImmutableList());
});
};