mattermost-mobile/app/selectors/views.js
Chris Duarte e4b86518a9 RN-342 Refactor post textbox component (#915)
* RN-342 Refactor post textbox component

* Rebase

* Review feedback
2017-09-20 16:40:40 -04:00

23 lines
576 B
JavaScript

import {createSelector} from 'reselect';
import {getCurrentChannel} from 'mattermost-redux/selectors/entities/channels';
function getChannelDrafts(state) {
return state.views.channel.drafts;
}
function getThreadDrafts(state) {
return state.views.thread.drafts;
}
export const getCurrentChannelDraft = createSelector(
getChannelDrafts,
getCurrentChannel,
(drafts, currentChannel) => drafts[currentChannel.id]
);
export const getThreadDraft = createSelector(
getThreadDrafts,
(state, rootId) => rootId,
(drafts, rootId) => drafts[rootId]
);