mattermost-mobile/app/screens/settings/general/index.js

43 lines
1.4 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 {clearErrors} from 'mattermost-redux/actions/errors';
import {getCurrentUrl, getConfig} from 'mattermost-redux/selectors/entities/general';
import {getJoinableTeams} from 'mattermost-redux/selectors/entities/teams';
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
import {goToScreen, dismissModal} from 'app/actions/navigation';
import {purgeOfflineStore} from 'app/actions/views/root';
import {removeProtocol} from 'app/utils/url';
import Settings from './settings';
function mapStateToProps(state) {
const config = getConfig(state);
return {
config,
theme: getTheme(state),
errors: state.errors,
currentUserId: state.entities.users.currentUserId,
currentTeamId: state.entities.teams.currentTeamId,
currentUrl: removeProtocol(getCurrentUrl(state)),
joinableTeams: getJoinableTeams(state),
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
clearErrors,
purgeOfflineStore,
goToScreen,
dismissModal,
}, dispatch),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(Settings);