mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-17 21:53:03 +05:30
Add loader during redirect to external site after oauth
This commit is contained in:
parent
1115f16262
commit
7f6eddf3c7
@ -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') {
|
||||
loader.show();
|
||||
|
||||
return new Promise(() => {
|
||||
// do not resolve promise to make loader visible and
|
||||
// overcome app rendering
|
||||
location.href = payload;
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.actions[actionId]) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user