on-the-fly: close modal only after validation

This commit is contained in:
nobohan
2022-02-03 11:07:32 +01:00
parent 4afea55465
commit 1f0ef6e187
5 changed files with 18 additions and 37 deletions

View File

@@ -69,7 +69,7 @@
:buttonText="$t('onthefly.create.button', {q: query})"
action="create"
@saveFormOnTheFly="saveFormOnTheFly"
:canCloseModal="canCloseOnTheFlyModal">
ref="onTheFly">
</on-the-fly>
</div>
@@ -121,7 +121,6 @@ export default {
selected: [],
priorSuggestion: {}
},
canCloseOnTheFlyModal: false
}
},
computed: {
@@ -271,7 +270,7 @@ export default {
makeFetch('POST', '/api/1.0/person/person.json', data)
.then(response => {
this.newPriorSuggestion(response);
this.canCloseOnTheFlyModal = true;
this.$refs.onTheFly.closeModal();
})
.catch((error) => {
if (error.name === 'ValidationException') {
@@ -287,7 +286,7 @@ export default {
makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data)
.then(response => {
this.newPriorSuggestion(response);
this.canCloseOnTheFlyModal = true;
this.$refs.onTheFly.closeModal();
})
.catch((error) => {
if (error.name === 'ValidationException') {
@@ -299,7 +298,6 @@ export default {
}
})
}
this.canCloseOnTheFlyModal = false;
}
},
}