mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-02 11:41:04 +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 { 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') {
|
||||||
location.href = payload;
|
loader.show();
|
||||||
return;
|
|
||||||
|
return new Promise(() => {
|
||||||
|
// do not resolve promise to make loader visible and
|
||||||
|
// overcome app rendering
|
||||||
|
location.href = payload;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.actions[actionId]) {
|
if (!this.actions[actionId]) {
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user