mattermost-mobile/app/screens/apps_form/index.ts
Daniel Espino García df7945318e
[Apps Framework] Separate calls (#5877)
* Port https://github.com/mattermost/mattermost-webapp/pull/9263 to mobile

* Fix forms props from commands and missing error->text change

* lint

* various fixes

* fix lookups for command parser

* update app command parser

* fixes

* fixes with embedded forms

* lint and types

* remove bindings.expanded fix for cleaning bindings on render

* lint

* re-expand bindings on post update

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
2022-03-24 11:03:06 -04:00

41 lines
1.5 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {connect} from 'react-redux';
import {ActionCreatorsMapObject, bindActionCreators, Dispatch} from 'redux';
import {doAppFetchForm, doAppLookup, doAppSubmit, postEphemeralCallResponseForContext} from '@actions/apps';
import {handleGotoLocation} from '@mm-redux/actions/integrations';
import {getTheme} from '@mm-redux/selectors/entities/preferences';
import {ActionFunc, GenericAction} from '@mm-redux/types/actions';
import {GlobalState} from '@mm-redux/types/store';
import {DoAppFetchForm, DoAppLookup, DoAppSubmit, PostEphemeralCallResponseForContext} from '@mm-types/actions/apps';
import AppsFormContainer from './apps_form_container';
type Actions = {
doAppSubmit: DoAppSubmit<any>;
doAppFetchForm: DoAppFetchForm<any>;
doAppLookup: DoAppLookup<any>;
postEphemeralCallResponseForContext: PostEphemeralCallResponseForContext;
};
function mapStateToProps(state: GlobalState) {
return {
theme: getTheme(state),
};
}
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
return {
actions: bindActionCreators<ActionCreatorsMapObject<ActionFunc>, Actions>({
doAppSubmit,
doAppFetchForm,
doAppLookup,
postEphemeralCallResponseForContext,
handleGotoLocation,
}, dispatch),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(AppsFormContainer);