adds blocked channel count
This commit is contained in:
parent
8406e8c25e
commit
d41a2a8a30
3 changed files with 7 additions and 3 deletions
|
@ -273,4 +273,4 @@ export {
|
||||||
|
|
||||||
export { selectFollowedTags, selectUnfollowedTags } from 'redux/selectors/tags';
|
export { selectFollowedTags, selectUnfollowedTags } from 'redux/selectors/tags';
|
||||||
|
|
||||||
export { selectBlockedChannels, selectChannelIsBlocked } from 'redux/selectors/blocked';
|
export { selectBlockedChannels, selectChannelIsBlocked, selectBlockedChannelsCount } from 'redux/selectors/blocked';
|
||||||
|
|
|
@ -11,7 +11,6 @@ export const blockChannelReducer = handleActions(
|
||||||
[ACTIONS.TOGGLE_BLOCK_CHANNEL]: (state: BlocklistState, action: BlocklistAction): BlocklistState => {
|
[ACTIONS.TOGGLE_BLOCK_CHANNEL]: (state: BlocklistState, action: BlocklistAction): BlocklistState => {
|
||||||
const { blockedChannels } = state;
|
const { blockedChannels } = state;
|
||||||
const { uri } = action.data;
|
const { uri } = action.data;
|
||||||
console.log('test', uri)
|
|
||||||
let newBlockedChannels = blockedChannels.slice();
|
let newBlockedChannels = blockedChannels.slice();
|
||||||
|
|
||||||
if (newBlockedChannels.includes(uri)) {
|
if (newBlockedChannels.includes(uri)) {
|
||||||
|
|
|
@ -5,7 +5,12 @@ const selectState = (state: { blockedChannels: BlocklistState }) => state.blocke
|
||||||
|
|
||||||
export const selectBlockedChannels = createSelector(
|
export const selectBlockedChannels = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
(state: BlocklistState) => state
|
(state: BlocklistState) => state.blockedChannels
|
||||||
|
);
|
||||||
|
|
||||||
|
export const selectBlockedChannelsCount = createSelector(
|
||||||
|
selectState,
|
||||||
|
(state: BlocklistState) => state.blockedChannels.length
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectChannelIsBlocked = (uri: string) => createSelector(
|
export const selectChannelIsBlocked = (uri: string) => createSelector(
|
||||||
|
|
Loading…
Reference in a new issue