From 9b715d618872796bf7d1a6531f8adaf941959012 Mon Sep 17 00:00:00 2001 From: Akhil Date: Tue, 30 Jul 2024 13:19:56 +0530 Subject: [PATCH 1/4] Disable buttons during API call --- src/Signup.vue | 8 +++++++- src/signup/RecoveryEmailForm.vue | 17 +++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/Signup.vue b/src/Signup.vue index 0bc40095..a14320ae 100644 --- a/src/Signup.vue +++ b/src/Signup.vue @@ -10,7 +10,10 @@ v-model="formData" :language="language" @form-submitted="submitCaptchaForm" /> - + @@ -60,6 +63,7 @@ export default { showRecoveryEmailForm: false, showSuccessSection: false, language: loadState(APPLICATION_NAME, 'lang'), + processingCreation: false, } }, mounted() { @@ -102,6 +106,7 @@ export default { async submitForm(data) { try { const url = generateUrl(`/apps/${this.appName}/accounts/create`) + this.processingCreation = true await Axios.post(url, data) // If the execution reaches here, the response status is in the 2xx range @@ -110,6 +115,7 @@ export default { this.showRecoveryEmailForm = false this.showSuccessSection = true } catch (error) { + this.processingCreation = false const genericErrorMessage = 'An error occurred while creating your account!' // Handle network errors and unexpected response structures here let errorMessage = error.response ? t(this.appName, error.response.data.message) : t(this.appName, error.message) diff --git a/src/signup/RecoveryEmailForm.vue b/src/signup/RecoveryEmailForm.vue index 00bc89e9..1df2ac2c 100644 --- a/src/signup/RecoveryEmailForm.vue +++ b/src/signup/RecoveryEmailForm.vue @@ -35,14 +35,26 @@ @@ -53,6 +65,7 @@ const APPLICATION_NAME = 'ecloud-accounts' export default { props: { value: Object, + processingCreation: Boolean, }, data() { return { -- GitLab From b61e697a9b7cd4976466763c4d5b62179251279c Mon Sep 17 00:00:00 2001 From: Akhil Date: Tue, 30 Jul 2024 13:23:27 +0530 Subject: [PATCH 2/4] Disable buttons in first page during API call --- src/signup/RegistrationForm.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/signup/RegistrationForm.vue b/src/signup/RegistrationForm.vue index aee692b6..b67300f6 100644 --- a/src/signup/RegistrationForm.vue +++ b/src/signup/RegistrationForm.vue @@ -150,8 +150,14 @@
@@ -199,6 +205,7 @@ export default { { message: t(this.appName, 'Incorrect password length: Required length is 8 to 32'), regex: /.{8,32}/ }, ], isUsernameAvailable: false, + processing: false, } }, computed: { @@ -285,6 +292,7 @@ export default { } }, async submitRegistrationForm() { + this.processing = true this.validateForm(['displayname', 'username', 'password', 'repassword', 'termsandservices']) await this.checkUsername() const isFormValid = Object.values(this.validation).every(value => !value) @@ -292,6 +300,7 @@ export default { if (isFormValid) { this.$emit('form-submitted', { isFormValid }) } + this.processing = false }, onLanguageChange() { window.location.href = window.location.origin + '/apps/' + APPLICATION_NAME + '/accounts/' + this.formData.selectedLanguage + '/signup' -- GitLab From c009f6c1ddade9b9bafc549641833b6c996a70a8 Mon Sep 17 00:00:00 2001 From: Akhil Date: Tue, 30 Jul 2024 13:29:57 +0530 Subject: [PATCH 3/4] disable when flag is true --- src/signup/RegistrationForm.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/signup/RegistrationForm.vue b/src/signup/RegistrationForm.vue index b67300f6..34d85342 100644 --- a/src/signup/RegistrationForm.vue +++ b/src/signup/RegistrationForm.vue @@ -151,7 +151,7 @@ -- GitLab