mattermost-mobile/app/actions/views/load_team.js
Chris Duarte bc18d60883 Fix login transition (#410)
* Fix login transition

* Add instant transition to modal

* Fix transition to show loader on first login

* Add loader to load_team

* Remove back button
2017-03-28 23:59:01 -03:00

36 lines
1.1 KiB
JavaScript

// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {NavigationTypes, ViewTypes} from 'app/constants';
import Routes from 'app/navigation/routes';
export function goToChannelView() {
return async (dispatch, getState) => {
const state = getState();
if (state.views.login.loginId) {
dispatch({
type: NavigationTypes.NAVIGATION_REPLACE_AT_ROOT,
route: Routes.ChannelView
}, getState);
dispatch({
type: NavigationTypes.NAVIGATION_CLOSE_MODAL
}, getState);
setTimeout(() => {
dispatch({
type: ViewTypes.APPLICATION_INITIALIZED
}, getState);
}, 800); // modal close takes 400ms
} else {
dispatch({
type: NavigationTypes.NAVIGATION_RESET,
routes: [Routes.ChannelView]
}, getState);
dispatch({
type: ViewTypes.APPLICATION_INITIALIZED
}, getState);
}
};
}