Fixed Input deletion on Add Team Member Popup. (#1316)

This commit is contained in:
Bogdan Artemenko 2019-02-14 18:02:22 +02:00 committed by GitHub
parent dfd6589fbe
commit b7d377bafb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,7 +69,6 @@
<script lang='ts'> <script lang='ts'>
import { Component, Vue } from 'vue-property-decorator'; import { Component, Vue } from 'vue-property-decorator';
import Button from '@/components/common/Button.vue'; import Button from '@/components/common/Button.vue';
import { removeToken } from '@/utils/tokenManager';
import { EMPTY_STATE_IMAGES } from '@/utils/constants/emptyStatesImages'; import { EMPTY_STATE_IMAGES } from '@/utils/constants/emptyStatesImages';
import { PM_ACTIONS, NOTIFICATION_ACTIONS, APP_STATE_ACTIONS } from '@/utils/constants/actionNames'; import { PM_ACTIONS, NOTIFICATION_ACTIONS, APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
import { EmailInput } from '@/types/EmailInput'; import { EmailInput } from '@/types/EmailInput';
@ -163,15 +162,29 @@ import { validateEmail } from '@/utils/validation';
deleteInput: function(index): void { deleteInput: function(index): void {
if (this.$data.inputs.length === 1) return; if (this.$data.inputs.length === 1) return;
(this as any).resetFormErrors(index);
this.$delete(this.$data.inputs, index); this.$delete(this.$data.inputs, index);
}, },
resetFormErrors: function(index): void { resetFormErrors: function(index): void {
this.$data.formError = '';
this.$data.inputs[index].setError(false); this.$data.inputs[index].setError(false);
if(!(this as any).hasInputError()) {
this.$data.formError = '';
}
}, },
onClose: function(): void { onClose: function(): void {
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_TEAM_MEMBERS); this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_TEAM_MEMBERS);
}, },
hasInputError: function (): boolean {
let hasError = false;
this.$data.inputs.some((element: EmailInput)=>{
if(element.error) {
hasError = true;
return true;
}
});
return hasError;
}
}, },
computed: { computed: {
isMaxInputsCount: function(): boolean { isMaxInputsCount: function(): boolean {
@ -187,7 +200,7 @@ import { validateEmail } from '@/utils/validation';
} }
return false; return false;
} },
}, },
components: { components: {
Button Button