Commit 425890c6 authored by Justin Ho's avatar Justin Ho

Move form ref to be a method

Defer fetching of Jira issueTypes until mounted to avoid
$refs not defined on the form.
parent 6b1db60e
...@@ -80,28 +80,28 @@ export default { ...@@ -80,28 +80,28 @@ export default {
disableButtons() { disableButtons() {
return Boolean(this.isSaving || this.isResetting || this.isTesting); return Boolean(this.isSaving || this.isResetting || this.isTesting);
}, },
form() {
return this.$refs.integrationForm?.$el;
},
}, },
methods: { methods: {
...mapActions(['setOverride', 'requestJiraIssueTypes']), ...mapActions(['setOverride', 'requestJiraIssueTypes']),
form() {
return this.$refs.integrationForm.$el;
},
setIsValidated() { setIsValidated() {
this.isValidated = true; this.isValidated = true;
}, },
onSaveClick() { onSaveClick() {
this.isSaving = true; this.isSaving = true;
if (this.integrationActive && !this.form.checkValidity()) { if (this.integrationActive && !this.form().checkValidity()) {
this.isSaving = false; this.isSaving = false;
this.setIsValidated(); this.setIsValidated();
return; return;
} }
this.form.submit(); this.form().submit();
}, },
onTestClick() { onTestClick() {
if (!this.form.checkValidity()) { if (!this.form().checkValidity()) {
this.setIsValidated(); this.setIsValidated();
return; return;
} }
...@@ -146,7 +146,7 @@ export default { ...@@ -146,7 +146,7 @@ export default {
this.requestJiraIssueTypes(this.getFormData()); this.requestJiraIssueTypes(this.getFormData());
}, },
getFormData() { getFormData() {
return new FormData(this.form); return new FormData(this.form());
}, },
onToggleIntegrationState(integrationActive) { onToggleIntegrationState(integrationActive) {
this.integrationActive = integrationActive; this.integrationActive = integrationActive;
......
...@@ -113,7 +113,7 @@ export default { ...@@ -113,7 +113,7 @@ export default {
return ''; return '';
}, },
}, },
created() { mounted() {
if (this.initialIsEnabled) { if (this.initialIsEnabled) {
this.requestJiraIssueTypes(); this.requestJiraIssueTypes();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment