Add loader during redirect to external site after oauth

This commit is contained in:
SleepWalker 2017-02-01 08:11:36 +02:00
parent 1115f16262
commit 7f6eddf3c7
2 changed files with 9 additions and 7 deletions

View File

@ -1,6 +1,7 @@
import { routeActions } from 'react-router-redux';
import logger from 'services/logger';
import loader from 'services/loader';
import RegisterState from './RegisterState';
import LoginState from './LoginState';
@ -63,8 +64,13 @@ export default class AuthFlow {
run(actionId, payload) {
if (actionId === 'redirect') {
location.href = payload;
return;
loader.show();
return new Promise(() => {
// do not resolve promise to make loader visible and
// overcome app rendering
location.href = payload;
});
}
if (!this.actions[actionId]) {

View File

@ -82,11 +82,7 @@ export default class CompleteState extends AbstractState {
if (resp.redirectUri.indexOf('static_page') === 0) {
context.setState(new FinishState());
} else {
return new Promise(() => {
// do not resolve promise to make loader visible and
// overcome app rendering
context.run('redirect', resp.redirectUri);
});
return context.run('redirect', resp.redirectUri);
}
}, (resp) => {
if (resp.unauthorized) {