mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Improve AuthFlow request handling logic
This commit is contained in:
@@ -28,6 +28,8 @@ export default class AuthFlow {
|
||||
const {routing} = this.getState();
|
||||
|
||||
if (routing.location.pathname !== route) {
|
||||
this.currentPath = route;
|
||||
|
||||
if (this.replace) {
|
||||
this.replace(route);
|
||||
}
|
||||
@@ -71,16 +73,6 @@ export default class AuthFlow {
|
||||
throw new Error('State is required');
|
||||
}
|
||||
|
||||
// if (this.state instanceof state.constructor) {
|
||||
// // already in this state
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (this.state instanceof ResendActivationState && state instanceof ResendActivationState) {
|
||||
// NOTE: a temporary workaround for resend-activation goBack to return to correct prevState
|
||||
return;
|
||||
}
|
||||
|
||||
this.state && this.state.leave(this);
|
||||
this.prevState = this.state;
|
||||
this.state = state;
|
||||
@@ -111,6 +103,14 @@ export default class AuthFlow {
|
||||
this.replace = replace;
|
||||
this.onReady = callback;
|
||||
|
||||
if (this.currentPath === path) {
|
||||
// we are already handling this path
|
||||
this.onReady();
|
||||
return;
|
||||
}
|
||||
|
||||
this.currentPath = path;
|
||||
|
||||
if (path === '/') {
|
||||
// reset oauth data if user tried to navigate to index route
|
||||
this.run('setOAuthRequest', {});
|
||||
|
Reference in New Issue
Block a user