signal-desktop/ts/state/selectors/safetyNumber.ts
2020-07-30 13:10:05 -07:00

24 lines
600 B
TypeScript

import { createSelector } from 'reselect';
import { StateType } from '../reducer';
import {
SafetyNumberContactType,
SafetyNumberStateType,
} from '../ducks/safetyNumber';
const getSafetyNumber = (state: StateType): SafetyNumberStateType =>
state.safetyNumber;
type Props = {
contactID: string;
};
const getContactID = (_: StateType, props: Props): string => props.contactID;
export const getContactSafetyNumber = createSelector(
[getSafetyNumber, getContactID],
(
{ contacts }: SafetyNumberStateType,
contactID: string
): SafetyNumberContactType => contacts[contactID]
);