diff --git a/src/components/profiles-modals/CreateProfileModal.vue b/src/components/profiles-modals/CreateProfileModal.vue index 97cfd7997..f8e696801 100644 --- a/src/components/profiles-modals/CreateProfileModal.vue +++ b/src/components/profiles-modals/CreateProfileModal.vue @@ -9,6 +9,7 @@ import ProfilesMixin from "../../components/mixins/ProfilesMixin.vue"; }) export default class CreateProfileModal extends ProfilesMixin { + private creatingInProgress: boolean = false; private newProfileName = ''; get isOpen(): boolean { @@ -17,17 +18,23 @@ export default class CreateProfileModal extends ProfilesMixin { closeModal() { this.newProfileName = ''; + this.creatingInProgress = false; this.$store.commit('closeCreateProfileModal'); } // User confirmed creation of a new profile with a name that didn't exist before. async createProfile() { + if (this.creatingInProgress) { + return; + } const safeName = this.makeProfileNameSafe(this.newProfileName); if (safeName !== '') { try { + this.creatingInProgress = true; await this.$store.dispatch('profiles/addProfile', safeName); this.closeModal(); } catch (e) { + this.creatingInProgress = false; const err = R2Error.fromThrownValue(e, 'Error whilst creating a profile'); this.$store.commit('error/handleError', err); } @@ -67,7 +74,7 @@ export default class CreateProfileModal extends ProfilesMixin { diff --git a/src/components/profiles-modals/DeleteProfileModal.vue b/src/components/profiles-modals/DeleteProfileModal.vue index d4f2dfc08..b0080afca 100644 --- a/src/components/profiles-modals/DeleteProfileModal.vue +++ b/src/components/profiles-modals/DeleteProfileModal.vue @@ -8,16 +8,23 @@ import ProfilesMixin from "../../components/mixins/ProfilesMixin.vue"; components: {ModalCard} }) export default class DeleteProfileModal extends ProfilesMixin { + private deletingInProgress: boolean = false; + get isOpen(): boolean { return this.$store.state.modals.isDeleteProfileModalOpen; } closeDeleteProfileModal() { + this.deletingInProgress = false; this.$store.commit('closeDeleteProfileModal'); } async removeProfile() { + if (this.deletingInProgress) { + return; + } try { + this.deletingInProgress = true; await this.$store.dispatch('profiles/removeSelectedProfile'); } catch (e) { const err = R2Error.fromThrownValue(e, 'Error whilst deleting profile'); @@ -41,6 +48,7 @@ export default class DeleteProfileModal extends ProfilesMixin {