Simplify makeGetAccount further

environments/review-change-ent-6o2wvy/deployments/3529
Alex Gleason 1 year ago
parent 8955a56c27
commit f46374fdac
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -23,23 +23,12 @@ const normalizeId = (id: any): string => typeof id === 'string' ? id : '';
const getAccountBase = (state: RootState, id: string) => state.accounts.get(id); const getAccountBase = (state: RootState, id: string) => state.accounts.get(id);
const getAccountRelationship = (state: RootState, id: string) => state.relationships.get(id); const getAccountRelationship = (state: RootState, id: string) => state.relationships.get(id);
const getAccountMoved = (state: RootState, id: string) => state.accounts.get(state.accounts.get(id)?.moved || '');
const getAccountMeta = (state: RootState, id: string) => state.accounts_meta.get(id);
const getAccountAdminData = (state: RootState, id: string) => state.admin.users.get(id);
const getAccountPatron = (state: RootState, id: string) => {
const url = state.accounts.get(id)?.url;
return url ? state.patron.accounts.get(url) : null;
};
export const makeGetAccount = () => { export const makeGetAccount = () => {
return createSelector([ return createSelector([
getAccountBase, getAccountBase,
getAccountRelationship, getAccountRelationship,
getAccountMoved, ], (base, relationship) => {
getAccountMeta,
getAccountAdminData,
getAccountPatron,
], (base, relationship, moved, meta, admin, patron) => {
if (!base) return null; if (!base) return null;
base.relationship = base.relationship ?? relationship; base.relationship = base.relationship ?? relationship;
return base; return base;

Loading…
Cancel
Save