From 95afcc69ddc0ea616b581084e9d98723a1a8efc7 Mon Sep 17 00:00:00 2001 From: dandds Date: Mon, 24 Sep 2018 15:00:01 -0400 Subject: [PATCH] tidy new project component a little --- js/components/forms/new_project.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/js/components/forms/new_project.js b/js/components/forms/new_project.js index 6201b3f5..994716fd 100644 --- a/js/components/forms/new_project.js +++ b/js/components/forms/new_project.js @@ -74,7 +74,7 @@ export default { }, validateAndOpenModal: function (modalName) { - const childrenValid = this.$children.reduce((previous, newVal) => { + let isValid = this.$children.reduce((previous, newVal) => { // display textInput error if it is not valid if (!newVal.showValid) { newVal.showError = true @@ -83,18 +83,17 @@ export default { return newVal.showValid && previous }, true) - const hasNames = this.environmentsHaveNames() - const uniqNames = this.envNamesAreUnique() - - if (!hasNames) { + if (!this.environmentsHaveNames()) { + isValid = false this.showMissingError = true } - if (!uniqNames) { + if (!this.envNamesAreUnique()) { + isValid = false this.showUniqueError = true } - if (childrenValid && hasNames && uniqNames) { + if (isValid) { this.openModal(modalName) } }