mattermost-mobile/app/mm-redux/reducers/requests/posts.ts
Elias Nahum aaa571db32
Upgrade to RN 0.62.2 (#4093)
* Upgrade to RN 0.62.0

* Update packager module paths

* Fix Android PasteableInput

* Fix regression on Android share extension credentials needed

* Update android/app/src/main/java/com/mattermost/rnbeta/RNPasteableEditTextOnPasteListener.java

* Reject commit if TSC check fails and Fix small eslint issues automatically

* Use super.getExportedCustomBubblingEventTypeConstants in RNPasteableTextInputManager

* Update to rn 0.62.2

Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>
2020-04-14 16:39:51 -04:00

47 lines
1.5 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {combineReducers} from 'redux';
import {PostTypes} from '@mm-redux/action_types';
import {handleRequest, initialRequestState} from './helpers';
import {GenericAction} from '@mm-redux/types/actions';
import {PostsRequestsStatuses, RequestStatusType} from '@mm-redux/types/requests';
function createPost(state: RequestStatusType = initialRequestState(), action: GenericAction): RequestStatusType {
if (action.type === PostTypes.CREATE_POST_RESET_REQUEST) {
return initialRequestState();
}
return handleRequest(
PostTypes.CREATE_POST_REQUEST,
PostTypes.CREATE_POST_SUCCESS,
PostTypes.CREATE_POST_FAILURE,
state,
action,
);
}
function editPost(state: RequestStatusType = initialRequestState(), action: GenericAction): RequestStatusType {
return handleRequest(
PostTypes.EDIT_POST_REQUEST,
PostTypes.EDIT_POST_SUCCESS,
PostTypes.EDIT_POST_FAILURE,
state,
action,
);
}
function getPostThread(state: RequestStatusType = initialRequestState(), action: GenericAction): RequestStatusType {
return handleRequest(
PostTypes.GET_POST_THREAD_REQUEST,
PostTypes.GET_POST_THREAD_SUCCESS,
PostTypes.GET_POST_THREAD_FAILURE,
state,
action,
);
}
export default (combineReducers({
createPost,
editPost,
getPostThread,
}) as (b: PostsRequestsStatuses, a: GenericAction) => PostsRequestsStatuses);