diff --git a/app/screens/root/index.js b/app/screens/root/index.js index 5124c9545..e6ec7ecc7 100644 --- a/app/screens/root/index.js +++ b/app/screens/root/index.js @@ -5,13 +5,14 @@ import {bindActionCreators} from 'redux'; import {connect} from 'react-redux'; import {loadMe} from 'mattermost-redux/actions/users'; - +import {getCurrentUser} from 'mattermost-redux/selectors/entities/users'; import {getTheme} from 'mattermost-redux/selectors/entities/preferences'; import Root from './root'; function mapStateToProps(state) { return { + currentUser: getCurrentUser(state), credentials: state.entities.general.credentials, theme: getTheme(state) }; diff --git a/app/screens/root/root.js b/app/screens/root/root.js index 60d1965be..40990fd88 100644 --- a/app/screens/root/root.js +++ b/app/screens/root/root.js @@ -12,6 +12,7 @@ import {stripTrailingSlashes} from 'app/utils/url'; export default class Root extends Component { static propTypes = { allowOtherServers: PropTypes.bool, + currentUser: PropTypes.object, credentials: PropTypes.object, justInit: PropTypes.bool, navigator: PropTypes.object, @@ -73,7 +74,7 @@ export default class Root extends Component { }; loadStoreAndScene = () => { - const {actions, credentials} = this.props; + const {actions, currentUser, credentials} = this.props; const {loadMe} = actions; if (credentials.token && credentials.url) { Client.setToken(credentials.token); @@ -81,7 +82,12 @@ export default class Root extends Component { Client4.setUrl(stripTrailingSlashes(credentials.url)); Client.setUrl(stripTrailingSlashes(credentials.url)); - loadMe().then(this.goToLoadTeam).catch(this.goToLoadTeam); + if (currentUser) { + loadMe(); + this.goToLoadTeam(); + } else { + loadMe().then(this.goToLoadTeam).catch(this.goToLoadTeam); + } } else { this.goToSelectServer(); }