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 {
diff --git a/src/components/profiles-modals/RenameProfileModal.vue b/src/components/profiles-modals/RenameProfileModal.vue
index f606d8521..8c40ce2de 100644
--- a/src/components/profiles-modals/RenameProfileModal.vue
+++ b/src/components/profiles-modals/RenameProfileModal.vue
@@ -11,6 +11,7 @@ import ProfilesMixin from "../../components/mixins/ProfilesMixin.vue";
export default class RenameProfileModal extends ProfilesMixin {
@Ref() readonly nameInput: HTMLInputElement | undefined;
private newProfileName: string = '';
+ private renamingInProgress: boolean = false;
@Watch('$store.state.profile.activeProfile')
activeProfileChanged(newProfile: Profile, oldProfile: Profile|null) {
@@ -41,12 +42,17 @@ export default class RenameProfileModal extends ProfilesMixin {
}
closeModal() {
+ this.renamingInProgress = false;
this.newProfileName = this.$store.state.profile.activeProfile.getProfileName();
this.$store.commit('closeRenameProfileModal');
}
async performRename() {
+ if (this.renamingInProgress) {
+ return;
+ }
try {
+ this.renamingInProgress = true;
await this.$store.dispatch('profiles/renameProfile', {newName: this.newProfileName});
} catch (e) {
const err = R2Error.fromThrownValue(e, 'Error whilst renaming profile');
@@ -85,7 +91,7 @@ export default class RenameProfileModal extends ProfilesMixin {
-
+