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

View File

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