web/satellite: prevent multiple request on login and registration (#3234)
This commit is contained in:
parent
8170eb8d23
commit
9f5d81b5b4
@ -35,10 +35,10 @@ export default class App extends Vue {
|
||||
'paymentSelect',
|
||||
];
|
||||
|
||||
private onClick(e: Event): void {
|
||||
public onClick(e: Event): void {
|
||||
let target: any = e.target;
|
||||
while (target) {
|
||||
if (this.$data.ids.includes(target.id)) {
|
||||
if (this.ids.includes(target.id)) {
|
||||
return;
|
||||
}
|
||||
target = target.parentNode;
|
||||
|
@ -25,6 +25,7 @@ export default class Login extends Vue {
|
||||
private email: string = '';
|
||||
private password: string = '';
|
||||
private authToken: string = '';
|
||||
private isLoading: boolean = false;
|
||||
|
||||
private readonly forgotPasswordPath: string = RouteConfig.ForgotPassword.path;
|
||||
private loadingClassName: string = LOADING_CLASSES.LOADING_OVERLAY;
|
||||
@ -53,9 +54,17 @@ export default class Login extends Vue {
|
||||
}
|
||||
|
||||
public async onLogin(): Promise<void> {
|
||||
if (this.isLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isLoading = true;
|
||||
|
||||
const self = this;
|
||||
|
||||
if (!self.validateFields()) {
|
||||
this.isLoading = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -63,6 +72,7 @@ export default class Login extends Vue {
|
||||
this.authToken = await this.auth.token(this.email, this.password);
|
||||
} catch (error) {
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, error.message);
|
||||
this.isLoading = false;
|
||||
|
||||
return;
|
||||
}
|
||||
@ -72,6 +82,7 @@ export default class Login extends Vue {
|
||||
setTimeout(() => {
|
||||
AuthToken.set(this.authToken);
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.CHANGE_STATE, AppState.LOADING);
|
||||
this.isLoading = false;
|
||||
this.$router.push(RouteConfig.ProjectOverview.with(RouteConfig.ProjectDetails).path);
|
||||
}, 2000);
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ export default class RegisterArea extends Vue {
|
||||
private passwordError: string = '';
|
||||
private repeatedPasswordError: string = '';
|
||||
private isTermsAcceptedError: boolean = false;
|
||||
private isLoading: boolean = false;
|
||||
|
||||
private loadingClassName: string = LOADING_CLASSES.LOADING_OVERLAY;
|
||||
|
||||
@ -69,16 +70,26 @@ export default class RegisterArea extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
public onCreateClick(): void {
|
||||
public async onCreateClick(): Promise<void> {
|
||||
if (this.isLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isLoading = true;
|
||||
|
||||
if (!this.validateFields()) {
|
||||
this.isLoading = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.loadingClassName = LOADING_CLASSES.LOADING_OVERLAY_ACTIVE;
|
||||
|
||||
this.createUser();
|
||||
await this.createUser();
|
||||
|
||||
this.loadingClassName = LOADING_CLASSES.LOADING_OVERLAY;
|
||||
|
||||
this.isLoading = false;
|
||||
}
|
||||
public onLogoClick(): void {
|
||||
location.reload();
|
||||
@ -153,6 +164,7 @@ export default class RegisterArea extends Vue {
|
||||
} catch (error) {
|
||||
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, error.message);
|
||||
this.loadingClassName = LOADING_CLASSES.LOADING_OVERLAY;
|
||||
this.isLoading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user