lbry-desktop/ui/redux/selectors/blocked.js
2020-06-23 16:01:20 -04:00

13 lines
535 B
JavaScript

// @flow
import { createSelector } from 'reselect';
const selectState = (state: { blocked: BlocklistState }) => state.blocked || {};
export const selectBlockedChannels = createSelector(selectState, (state: BlocklistState) => state.blockedChannels);
export const selectBlockedChannelsCount = createSelector(selectBlockedChannels, (state: Array<string>) => state.length);
export const selectChannelIsBlocked = (uri: string) =>
createSelector(selectBlockedChannels, (state: Array<string>) => {
return state.includes(uri);
});