mattermost-mobile/app/screens/select_server/index.js
Miguel Alatzar 2d81b497cf [MM-23520] Port mattermost-redux (#4088)
* Remove mattermost-redux

* Move mm-redux files into app/redux

* Add @redux path to tsconfig.json

* Fix imports

* Install missing dependencies

* Fix tsc errors

* Fix i18n_utils test

* Fix more imports

* Remove redux websocket

* Fix tests

* Rename @redux

* Apply changes from mattermost-redux PR 1103

* Remove mattermost-redux mention in template

* Add missing imports

* Rename app/redux/ to app/mm-redux/

* Remove test file

* Fix fetching Sidebar GM profiles

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2020-04-17 21:12:09 -07:00

51 lines
1.7 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {getPing, resetPing, setServerVersion} from '@mm-redux/actions/general';
import {login} from '@mm-redux/actions/users';
import {getConfig, getLicense} from '@mm-redux/selectors/entities/general';
import {setLastUpgradeCheck} from 'app/actions/views/client_upgrade';
import {handleSuccessfulLogin, scheduleExpiredNotification} from 'app/actions/views/login';
import {loadConfigAndLicense} from 'app/actions/views/root';
import {handleServerUrlChanged} from 'app/actions/views/select_server';
import getClientUpgrade from 'app/selectors/client_upgrade';
import SelectServer from './select_server';
function mapStateToProps(state) {
const config = getConfig(state);
const license = getLicense(state);
const {currentVersion, latestVersion, minVersion} = getClientUpgrade(state);
return {
...state.views.selectServer,
config,
currentVersion,
hasConfigAndLicense: Object.keys(config).length > 0 && Object.keys(license).length > 0,
latestVersion,
license,
minVersion,
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
handleSuccessfulLogin,
getPing,
scheduleExpiredNotification,
handleServerUrlChanged,
loadConfigAndLicense,
login,
resetPing,
setLastUpgradeCheck,
setServerVersion,
}, dispatch),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(SelectServer);